Defending champion Rafael Nadal dug deep to outmanoeuvre powerful Russian Karen Khachanov and win their thrilling US Open third-round match in four sets.
Nadal, 32, was a set and a break down before fighting back to win 5-7 7-5 7-6 (9-7) 7-6 (7-3).
The Spanish top seed failed to serve out the match at 5-4 in the fourth, but recovered to take the tie-break.
World number one Nadal will play Georgia's Nikoloz Basilashvili in the last 16.
The 17-time Grand Slam champion, aiming for a fourth US Open title, needed all of his enormous will-to-win and tactical nous to see off Khachanov, who hit 22 aces and 66 winners.
The match ebbed and flowed throughout as it became one of the matches of the tournament so far.
It was Nadal's first real test after not dropping a set in his previous two matches at Flushing Meadows.
Nadal had breezed into the third round after David Ferrer, his close friend and Davis Cup colleague, retired injured in the opening round and Canada's Vasek Pospisil was swatted off in three sets on Wednesday.
This time he was pushed all the way by 22-year-old Khachanov, who showed why he is considered one of the game's rising stars.
After Nadal moved into a two-sets-to-one lead, the world number 26 may have been expected to fade.
Yet he showed remarkable resolve to stop Nadal serving out at 5-4 and take the fourth set to a tie-break.
From there, Nadal regained control - although not before missing two of his five set points - to clinch victory in four hours 23 minutes.
Bending his knees, raising his arms and roaring into the air, Nadal's relief was evident in his exuberant celebration.
Rain during the second set meant that the roof was then closed on Arthur Ashe Stadium for the rest of the match
Khachanov had never taken a set off Nadal in their four previous meetings but, after winning the opener, was left to rue not taking another golden opportunity which came his way in the second set.
If a break to love in the second game was too early to leave Arthur Ashe Stadium sensing an upset, another by the Russian for a 5-4 lead - after Nadal had levelled a game earlier - certainly did.
Not for long, however.
Khachanov wobbled in the next game and failed to consolidate, allowing Nadal to level again before rain interrupted what was fast becoming an epic.
The break allowed Nadal some much-needed thinking time to make a tactical tweak, returning with added pace and precision on his forehand side.
Khachanov felt the pressure on his serve at 6-5, coughing up two double faults and allowing Nadal to take the set in deuce.
Nadal began to look more comfortable in his service games in the third set, although could not take the only break opportunity which came his way at 3-2.
That led to a captivating tie-break which would prove pivotal.
Four set points were blown by Nadal as tension started to creep in on both sides of the net, before an aggressive second serve by Khachanov at 8-7 led to his third double fault of the breaker and handed over a fifth chance for Nadal.
This time he came out on top after toughing out a baseline rally to win a remarkable 39-shot rally which brought Ashe almost entirely to its feet.
Khachanov beating a top-five player for the first time looked unlikely from that point - and so, ultimately, it proved.