Andre Agassi battled past Xavier Malisse 6-3 6-4 6-7 (5-7) 4-6 6-2 to reach the US Open quarter-finals.
The 35-year-old American was back to his best producing an array of powerful strokes to move to within two points of the match in the third set tie-break.
But his resolve faltered and Malisse took the breaker before racing to the fourth with some good work at the net.
Cheered on by the crowd, Agassi broke the Belgian twice in the fifth and stayed strong to close out the match.
The veteran will now play American wildcard James Blake in a mouth-watering encounter on Wednesday.
Agassi, who won the title in 1994 and 1999, was untroubled in the opening set, controlling play from the baseline.
The unseeded Malisse responded in the second, forcing Agassi to save three break-points in the fourth game.
But it was Agassi who made the decisive break at 4-3 as his aggressive returns forced the Belgian into errors.
A tight third set went to the tie-break and it was Malisse who clinched it 7-5 to claw back into contention.
A revitalised Malisse could not put a foot wrong on Arthur Ashe Court in the fourth.
He followed up four aces in his service game with a break to love at 3-2 before comfortably closing out the set with some attacking play at the net.
But Agassi dug deep in the fifth and, with the partisan crowd on the edge of their seats, broke Malisse to move 3-1 up.
The American veteran broke again as Malisse's accuracy deserted him to seal the match in just under three hours.
"I came out there striking the ball really well," said Agassi, who reached his 13th US Open quarter-final.
"I was doing well to hang on in the third and he outplayed me in the fourth and was just too good.
"I was hoping to do something different in the fifth set and it felt great. My body feels good right now."