6-4 win for Thiem sets up an intriguing semi-final today with Djokovic, the world No 1 from Serbia.
World number one Djokovic and five-time victor Nadal each progressed in straight sets, seeing off Jeremy Chardy and Frances Tiafoe respectively. In Friday's other quarter-finals, Stefanos Tsitsipas faces Alexander Zverev and second seeded Rafa Nadal plays Stan Wawrinka.
This was a significant win for the world's best player, against an opponent in prime form.
Federer might have been given a scare, but he was pleased to be ultimately rewarded for an aggressive approach as he continues to adapt to the clay courts once more.
"I feel very good about my game".
"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. "I feel good on the clay right now", Roger Federer continued.
The Swiss said that he will leave it late before making his decision on whether he wants to take up a wild card entry organisers in the Italian capital have been holding back for him.
This mouthwatering encounter will tell us an very bad lot about both players form going into the French Open.
Djokovic, victor in Madrid in 2011 and 2016, was fully rested after his quarter-final opponent Marin Cilic had withdrawn because of food poisoning, while Thiem had to dig deep to beat Roger Federer in a gruelling three-setter. "I was very nervous, so I just figured, 'come to the net, take a chance, ' and it worked out".
Monfils, with a smile on his face, stole the momentum from Federer and broke the veteran tennis player at 4-5.
Thiem broke early in the decider, but Federer responded in typical fashion to make it 4-4. Federer got back on serve at 4-4, but started his next game 0-40 and couldn't recover.
In the women's competition, French Open champion Simona Halep is through to the final after fending off a tough challenge from Belinda Bencic.
Nadal stayed in contention for his sixth Madrid title with a 6-3, 6-4 win over American Frances Tiafoe.
"It's such a nice feeling to be back in the final here".