Dominic Thiem saved match points to end Roger Federer's clay-court return and reach the Madrid Open semi-finals.
Swiss Federer saved match points in his quarter-final on Thursday but squandered two of his own in the second-set tie-break against Thiem.
Austria's Thiem eventually came through 3-6 7-6 (13-11) 6-4 to set up a meeting with world number one Novak Djokovic.
Second seed Rafael Nadal cruised into the semi-finals with a 6-1 6-2 win over Switzerland's Stan Wawrinka.
Spaniard Nadal, a five-time champion in Madrid, needed just 69 minutes to beat Wawrinka.
He will face ninth seed and rising star Stefanos Tsitsipas next after the Greek beat defending champion Alexander Zverev 7-5 3-6 6-2.
Germany's Zverev, seeded third in Madrid, will fall to fifth in the rankings on Monday.
Fifth seed Thiem previously beat 20-time Grand Slam champion Federer in the Indian Wells final in March.
Fourth seed Federer, 37, was playing in his first clay-court tournament for three years.
Thiem, a predominantly clay-court player who lost to Rafael Nadal in last year's French Open final, recovered from a slow start against Federer.
He created five break points on the Federer serve in the second set, but the Swiss held to force an eventual tie-break.
Federer had match point at 8-7 and 10-9 in the tie-break but Thiem saved them both and won four of the final five points to ensure a deciding set.
Thiem broke Federer early and went on to serve out the match at the second attempt.
He will play Djokovic on Saturday after the Serb received a walkover to the semi-finals.
Djokovic had been set to face Marin Cilic but the Croat pulled out after suffering with food poisoning.