World number one Rafa Nadal ran into a spot of bother before crushing Argentine Leonardo Mayer and booking his place in the last 16 of the U.S. Open.
The Spaniard lost the first set but managed to claw back and win in four, with a 6-7(3) 6-3 6-1 6-4 victory.
Nadal, chasing his second grand slam title of the year, was on the back foot early on but once he found his rhythm, the contest was virtually over under a closed roof on Arthur Ashe Stadium.
He will next face Ukraine's Alexandr Dolgopolov.
"It was a tough situation for a set and I had some break points against me early in the second. I fought, I was there mentally and then I started to play much better," said Nadal.
"I must improve on the forehand. At the end of the match I was creating more space but at the beginning I failed to convert several chances with my forehand."
Mayer played some steely tennis in the first set, hitting neat and powerful shots to stave off six break points and force a tiebreak, in which the Argentine was always in control.
In the tiebreak, he took a mini-break for 3-2 when Nadal inexplicably netted a routine backhand and then sealed it with an unreturnable serve.
Nadal was hanging by his teeth, facing two break points in the fourth game of the second set. Two massive shots saved him and he got to level for 2-2 as he let out a huge 'Vamos', raising his clenched fist towards the crowd.
Mayer briefly threatened a comeback when he pulled a break back for 5-3 in the fourth set but Nadal served it out at 5-4 with Mayer sending a forehand long on match point.