Defending champion Rafael Nadal reached the US Open last 16 with a 7-6 6-1 7-5 victory over David Nalbandian.
The second-seeded Spaniard was far from at his best and he trailed the 76th-ranked Argentine 3-5 in the first set, then was broken when he served for the match in the ninth game of the third.
"It was a tough day. David is a fantastic player and a close friend who has had a tough time with injuries," said Nadal.
"The first set was key when I came back when he was serving for the set. I am happy because I played my best match of the tournament so far."
Nalbandian, who reached three in the world in 2006 before his career was stalled by hip and groin surgery, went into the the tie on Arthur Ashe Stadium with a 2-2 career record against the Spaniard.
It could have been 3-2 had Nalbandian won the first set, and he went close to doing just that.
An uncharacteristic double fault from Nadal on break point in the fifth game gave the Argentinian the lead and he looked favourite to take the set as he tested the world number two in his next two service games.
But, serving for the set, Nalbandian faltered, with some great play from his opponent setting up break point, which the former Wimbledon finalist donated with a huge double fault.
The 29-year-old's talent has never been in doubt - he has reached the semi-final stage at every grand slam and lost to Lleyton Hewitt in the Wimbledon final in 2002 - but too often his body and his nerve have let him down.
He held on to force a tie-break that was as tight as the preceding 12 games had been, but Nadal upped the ante when he needed to to secure a mini-break at 5-5 and finished off the set with a big serve and trademark forehand down the line.
It was a top quality set of tennis from both men, with Nadal making only four unforced errors, and the effort seemed to take its toll on Nalbandian as he promptly lost the next four games and, in 27 minutes, the second set.
He found his range again at the start of the third, breaking the Nadal serve immediately, but the Spaniard wasted no time in getting back on level terms and then took an injury time-out to receive treatment for blisters on his right foot.
It did not seem to affect the 25-year-old's movement and he broke again for 4-2 but, serving for the match, he again threw in a double fault on break point, Nalbandian successfully challenging a line call to get back to 5-4 down.
He then had another break point to take a fourth game in a row but could not take it and Nadal promptly brought up three match points on his opponent's serve, taking the third when Nalbandian double-faulted for a seventh time.
It was a great effort from the Argentinian, but 60 unforced errors in comparison to 18 from the champion proved the difference.
Up next in the last 16 for the 10-time Grand Slam title winner is world No.68 Gilles Muller of Luxembourg, who eased past Russia's Igor Kunitsyn 6-1 6-4 6-4.
Fifth seed David Ferrer needed less than two hours to beat Florian Mayer in the third round.
The Spaniard defeated the 26th-seeded Mayer 6-1 6-2 7-6 (7/2) in an hour and 47 minutes.
Germany's Mayer was in the third round at the US Open for the first time bu suffered from making 31 unforced errors.