Murray had not dropped a set on his way to the last four
Andy Murray avenged his US Open final loss to former world number one Roger Federer by beating him 3-6 6-3 7-5 to reach the final of the Madrid Masters.
There he will play unseeded Frenchman Gilles Simon, after his shock 3-6 7-5 7-6 (8-6) win over Rafael Nadal.
Federer broke Murray in the sixth game on his way to taking the first set but the 21-year-old levelled in the next.
A third set went with serve until the 11th game when Murray clinched the match-winning break of serve.
Murray, who lost in straight sets to Federer at Flushing Meadows in September, had not dropped a set in his march to the last four.
And the Briton, looking for a second successive Masters Series title after victory in Cincinnati in August, admitted his serve had been crucial to his fightback.
"When Roger gets ahead he plays really aggressive, he plays with a lot of confidence and he really races through his service games," he said.
"I was lucky in the second set, I managed to go ahead early and relax a bit from there. I had to try and take my chances, which is tough against him because he plays so well on the big points.
"I served great, and that was the key. I didn't give him too many chances and that was the reason I won."
Federer said: "I thought Andy served very well and returned much more comfortably than at the US Open. He did well to hang in there and it was a close match."
Serve dominated the opening five games before the former world number one broke Murray when the Scot overhit a forehand to take a 4-2 lead.
Murray had a chance to hit back immediately when a mis-hit Federer forehand gave him a break point, but his opponent saved that before holding to establish a 5-2 advantage.
The Swiss soon wrapped up the set but Murray, chasing his fourth ATP title this year, served well to help him put Federer under pressure in the second.
The world number four broke serve in the fourth game, taking advantage of a rare Federer mistake on break point.
Murray drove home his advantage by comfortably holding serve to move 4-1 ahead.
The next three games went with serve, leaving Murray with the chance to serve for the set, which he duly did by winning three quick points before levelling the match with an unstoppable forehand.
Murray survived a scare on his serve in the eighth game of the final set and held his nerve again when 5-4 down.
Federer then found his serve under pressure and saved one break point before Murray swooped to take his chance second time around.
Murray then held his serve impressively to clinch his third win in five over Federer.
Simon's win over Nadal was all the more impressive as it came after a three-and-a-half hour battle, during which he saved 17 breakpoint chances - including seven in the final set.
Murray and Simon have met twice before, both times on clay, with the Frenchman victorious in three sets in Rome last year but Murray winning in straight sets in Hamburg earlier this year.