Rafael Nadal saved four match points before seeing off David Goffin 6-3 5-7 7-6 (11-9) to book his place in the Madrid Open quarter-finals.
A five-time champion in the Spanish capital, Nadal is looking to match Novak Djokovic's career record of 37 ATP Masters 1000 titles this week.
Returning to action for the first time since losing to Taylor Fritz in the Indian Wells final, after which he discovered he had a stress fracture of a rib, Nadal was taken all the way by Goffin.
Indeed, the Belgian qualifier won four straight games from 5-3 down in the second set to force a decider, but he saw four opportunities to advance to the quarter-finals go begging.
Nadal subsequently prevailed to reach his 99th Masters 1000 quarter-final, setting up a last-eight showdown with teenage compatriot Carlos Alcaraz.
Birthday boy Alcaraz, who turned 19 on Thursday, celebrated with a hard-earned 6-4 6-7 (4-7) 6-3 victory over Britain's Cameron Norrie.
Defending champion Alexander Zverev reached his fifth successive quarter-final at this event after beating Lorenzo Musetti, who retired with a thigh injury shortly after losing the opening set, at 6-3 1-0 down.
Djokovic
Next up for Zverev is Felix Auger-Aliassime, the Rotterdam Open champion, who is targeting a first clay-court Masters 1000 semi-final. Auger-Aliassime won 90 per cent of points on first serve in a commanding 6-1 6-2 victory over Jannik Sinner.
Stefanos Tsitsipas also produced a strong-serving display in his 6-3 6-4 triumph over Grigor Dimitrov. Last season’s French Open runner-up hit 10 aces along the way.
The fourth seed set up a showdown with Andrey Rublev, who had eight aces as he overcame Dan Evans 7-6 (9-7) 7-5.
Meanwhile, Hubert Hurkacz will play Djokovic in the last eight after hitting 16 aces in his 7-5 6-3 win over Dusan Lajovic. Djokovic's much-anticipated clash with Andy Murray was called off, with the Briton unwell, handing his Serbian rival a walkover.