The 20-time grand slam champion, who is playing his first tournament on the
surface for three years, saved two match points in beating Gael Monfils on
Thursday but the boot was on the other foot this time.
Federer won the first set and held two match points in the second set tie break but Thiem, last year's French Open finalist, fought back to win 3-6 7-6 (11) 6-4.
— ATP Tour (@ATP_Tour) May 10, 2019
Federer said on atptour.com: "It's frustrating, clearly. Losing with match points is the worst. But, nevertheless, if I take a step back, it's all good. I feel very good about my game."
In the last four, Thiem will meet Novak Djokovic, who was given a
walkover when Marin Cilic withdrew with food poisoning.
Rafael Nadal produced his best performance on clay this season to defeat Stan Wawrinka 6-1 6-2.
The 11-time French Open champion unusually arrived in the Spanish capital still looking for his first title of the year but it is unlikely to remain that way for long if he continues to play like this.
Wawrinka simply could not cope with the consistent excellent of Nadal, who will face Stefanos Tsitsipas for a place in the final.
Tsitsipas, who was brushed aside by Nadal at the Australian Open, claimed another notable victory by beating defender champion Alexander Zverev 7-5 3-6 6-2.