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.
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."
His next opponent, seeded one, 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 Rafael Nadal plays Stan Wawrinka.
Halep to face Bertens in Madrid Open final
Simona Halep reached her fourth Madrid Open final with a 6-2, 6-7(2), 6-0 win over Belinda Bencic on Friday and will face last year's runner up Kiki Bertens, who beat Sloane Stephens 6-2, 7-5.
World number three Halep can move back to the top of the WTA rankings with a win in Saturday's final.
Twice Madrid winner Halep broke the unseeded Bencic in the first game of the first set, the Swiss's errant backhand flying out, but she broke back to tie at 2-2.
The Romanian broke for a 3-2 lead and a down-the-line shot sealed another break in the penultimate game before she served out to win it comfortably in 27 minutes.
Halep won virtually all of the long rallies, but Bencic reacted well at the start of the second set, playing more aggressively.
Bencic broke to go 3-1 up, enjoying a stroke of luck with a shot that clipped the net and dropped just over.
Halep battled back, earning a tiebreak, but Bencic won it comfortably to force a deciding set, although she immediately started to struggle.
At three games down, she cried during the changeover, with Halep immediately breaking for 4-0 when play resumed, going on to wrap up the set and the match with ease.
"It's a nice feeling to be back in the final of this special tournament, I'm really happy playing here," said Halep.
"In the second set in that tiebreak I was rushing too much, I lost control of it, but then I just calmed down, told myself I had to start the match again.
"I started to play smarter, opened the court more and became more aggressive."
Bertens had to save three set points against Stephens but eventually recorded her first victory against the American in their third encounter.
The Dutch world number seven triumphed in St Petersburg this season and is going for her ninth career title on Saturday.
"I feel unbelievable of course, it's great to be in the final and I'm happy to finish it in two (sets)," said Bertens.
"It's going to be really tough (against Halep), we played each other in the past so I know it will be a tough battle, but I'm ready for it, one more push here."
'Forever yes': Stephens to wed soccer player Altidore
'India needs to do lot more for women empowerment'
Parineeti turns babysitter for Sania's son Izhaan
New French Open court unveiled as prize money increases