It was the second time in the tournament that Nadal had dropped a set following his win over Francisco Cerundolo earlier in the week as he began his quest for a 23rd Grand Slam title.
“Every day is a challenge, that’s the truth. All opponents are difficult,” Nadal said in his on-pitch interview.
“We’re playing against the best players in the world… Every day is an opportunity to improve and today I’m done, it gives me a chance to continue – very happy about that.”
After Nadal won the first two sets, world No. 106 Berankis hit back in the third thanks to an early break of serve.
There was a 50-minute rain delay in game four to allow the roof to close, but Nadal was already 3-0 in the set and soon ended the match in just over three hours when play resumed.
The 36-year-old meets the number 27 seeded Italian Lorenzo Sonego in the third round on Saturday.