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.
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.