Thiem gets his second straight victory over Federer and will face Novak Djokovic in the semis.
MADRID — Roger Federer wasted two match points in a 3-6, 7-6 (11), 6-4 loss to Dominic Thiem in the quarterfinals of the Madrid Open on Friday.
The fifth-seeded Thiem outlasted Federer in the second-set tiebreaker and broke him twice in the third set to close out the match in more than two hours.
Thiem, the runner-up in Madrid the last two seasons, will next face top-ranked Novak Djokovic, who didn't have to play his quarterfinal after Marin Cilic withdrew because of food poisoning.
Federer had saved two match points himself in a difficult three-set win over Gael Monfils on Thursday. The Madrid Open was his first clay-court tournament in three years.
The fourth-seeded Federer skipped the clay swing the past two seasons to remain fit for the rest of the season. He decided to return this year in preparation for his first French Open appearance since 2015.
Federer was trying to win his third Madrid title, and first since 2012. He has already won hard-court titles this season in Dubai and Miami.
Thiem has a chance to win his third title of the year after victories in Barcelona and Indian Wells, where he defeated Federer in a three-set final.
On the women's side, Simona Halep made it back to the Madrid final for the first time since 2017 with a 6-2, 6-7 (2), 6-0 win over unseeded Belinda Bencic.
The French Open champion can surpass Naomi Osaka for the No. 1 ranking if she wins Saturday's final in the Spanish capital.
The other semifinal will be played between Sloane Stephens and Kiki Bertens, last year's runner-up.
The 37-year-old Federer got off to a great start against Thiem at the Magic Box center court, breaking the Austrian's serve early and cruising to a first-set win. He squandered five break points in the second, and then had match points at 8-7 and 10-9 in the tiebreaker before Thiem forced the deciding set by converting his sixth set point.
Thiem broke Federer for the first time in the third game of the third set, converting on his ninth break opportunity of the match. Federer got back on serve at 4-4, but started his next game 0-40 and couldn't recover. Thiem then served out for the victory, converting on his second match point.
Thiem has won the last two matches he played against Djokovic, who got the day off because of Cilic's withdrawal.
''It was supposed to be definitely a good match,'' said Djokovic, who has played only four sets this week. ''I went back on the court, trained for another hour and got a good sweat in. Happy that I'm going to be fresh for my semifinal.''
The top-seeded Serb is seeking a third Madrid Open title, and his second of the season after winning the Australian Open.