A day after saving two match points at the Madrid Open, Federer squandered two match points himself in the quarterfinals against Dominic Thiem on Friday, losing 3-6, 7-6 (11), 6-4.
It may have ended his first appearance at a clay-court tournament in three years, but Federer wasn't leaving the Spanish capital too disappointed with the outcome of his return.
"I feel very good about my game. I thought I had some good matches here," Federer said. "I feel good on the clay right now. It's been a good week. Frustrating, clearly. Losing with match points is the worst, so that's how I feel. But nevertheless, if I take a step back, it's all good."
Federer skipped the clay swing the past two years 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.
The fifth-seeded Thiem, 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.
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.
"Facing him, it always requires my absolute best game and also a little bit luck, which I both had in Indian Wells and also here, and that's why I won these two matches," Thiem said.
The other semifinal will be between Stefanos Tsitsipas and five-time Madrid champion Rafael Nadal. Tsitsipas defeated defending champion Alexander Zverev 7-5, 3-6, 6-2, while Nadal cruised past Stan Wawrinka 6-1, 6-2.
Nadal lost only seven points on his service games, conceding no break opportunities against the 34th-ranked Wawrinka. The Swiss lost the 2013 Madrid final to Nadal.
"It was one of my best matches in a long time, my best match on clay this year," the second-ranked Spaniard said. "It means a lot to have this feeling in this crucial moment of the clay season."
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.
"I don't want to think about that. For me, it is more important to win the trophy here than being No. 1," the third-ranked Halep said. "I prefer titles than numbers and rankings. So this is my goal, to play finals and to win trophies."
She will face last year's runner-up Kiki Bertens, who defeated Sloane Stephens 6-2, 7-5.
The 37-year-old 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.
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.
Federer had saved two match points in his difficult three-set win over Gael Monfils on Thursday.
Thiem broke Federer for the first time in the third game of the third set, converting 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.
Thiem lost the Madrid final to Nadal in 2017 and to Alexander Zverev in 2018.
"I was playing Novak last year and two years ago and he was not at his best I guess, and now he is again," Thiem said. "He's won the last three Slams and he is at the top of the ranking again. So the challenge couldn't be bigger."