Dominic Thiem edged a thrilling clash with Roger Federer 3-6 7-6(11) 6-4 to end the Swiss veteran's clay season comeback and reach the Madrid Open semi-finals on Friday. The fifth-seeded Austrian, who saved two match points, will face Novak Djokovic on Saturday after the world number one's opponent Marin Cilic withdrew with food poisoning. Federer, playing his first clay tournament for three years, raced into a 4-1 lead inside 15 minutes as he broke the 220 kilometres-per-hour barrier with some powerful serving. He showed the same drive that saw him bagel Gael Monfils in the first set on Thursday. The Frenchman had then battled back to force a thrilling tie-break finale in the third set, and Thiem upped his game significantly too, taking the second set to the wire. Federer survived three game points to hold serve for 3-3 before Thiem eventually triumphed 13-11 in a gripping tie-break, saving two match points to force a decider. Thiem broke to go 2-1 in the third. Federer broke back to pull level at 4-4 but the Austrian broke again in the next game, sealing it with a sensational forehand over his opponent before serving out the match. "Today was so close, I was really lucky," said Thiem. "Roger is playing really well on clay so I am really happy. He's so special, maybe the best player ever in tennis. It's so tough every single time you play against him, itВґs pure beauty how he plays the game, every point against him is a challenge. "It's also a bit about luck and I was the luckier one today." Thiem's next opponent, Djokovic, will be well rested after Cilic's unfortunate exit. "I have had a terrible night dealing with a case of food poisoning. I am extremely disappointed to have my time in Madrid end in this way. Thank you for the support," the Croatian said on Twitter. In Friday's other quarter-finals, Stefanos Tsitsipas faces Alexander Zverev and second seeded Rafa Nadal plays Stan Wawrinka.