Stingy on serve and dominant at the net, the 17-times Grand Slam champion wobbled when serving out for the match at 5-4 in the third set and was dragged into a tie-break in an atmosphere of unrelenting tension at Rod Laver Arena.
Battling fatigue, Murray saved two match-points to keep his bid for a third Grand Slam title alive but met ever stiffer resistance from the imperious Swiss who attacked his serve with abandon in the final set.
Having saved a raft of break points, the 26-year-old crumbled at 4-3 to concede the decisive break and Federer made no mistake on his third match point, sealing the thriller with an ace after three hours and 20 minutes.
"Andy played well and put the pressure on me so I'm happy to get the win," a relieved Federer said in a courtside interview after notching his 11th successive semi-final appearance at Melbourne Park.
"I probably miss more break points than other guys but I keep my composure and keep the poker face and tonight it worked."
Having mowed down Jo-Wilfried Tsonga in straight sets in his previous match, the red-hot Swiss appeared set to do the same to Murray, who showed signs of his lack of match practice on the comeback from back surgery.
Federer prised two break points in just the fourth game by rushing the net and volleying into the corner, and Murray, struggling to find his range, duly lost serve by clubbing a forehand long.
Murray sent two of his rackets to be re-strung and though the Scot buoyed himself with a couple of sizzling passing shots, Federer calmly served out the final game of the set to love, sealing it with a huge first serve.
Serving in the opening game of the second, Murray fired himself up by winning a thrilling 23-shot rally, but was down a break again at 2-2 after blasting a forehand crosscourt just wide as Federer ratcheted up the pressure.
Unable to get a look at Federer's serve, and outplayed on the baseline, Murray slumped to a two-set deficit after losing a series of attritional rallies.
Pushed to the wall, the Scot saved four break points in his first two service games of the third set, and winced with pain after reaching for a low ball, laying a hand on his lower back.
The pressure finally told as Murray netted a forehand to be broken at 4-4, but Federer, inexplicably, wavered when serving for the match.
Having not given up a single break point, Federer conceded two with a pair of unforced errors, and Murray sealed the second after running the Swiss ragged.
Dragged into a tiebreak, Federer showcased a brilliant defence to leap to a 5-2 lead and held two match-points when Murray floated a backhand long.
The pressure reaching breaking point, Murray saved both, surviving the first with an epic 24-shot rally, before clobbering a forehand down the line to raise set point.
Suddenly tentative, Federer fluffed a halfhearted forehand to concede the set, leaving Murray to punch his fists and roar.
Under siege for 19 minutes in his next service game, Murray saved six break points and then another at 3-2 down.
Federer was unrelenting, however, and had another three chances to break at 4-3. Murray saved the first two, but was beaten by a sumptuous drop-shot that he could only play back to the Swiss who pushed the volley into an open court.
Murray came again, putting Federer under pressure again at 0-30 but the Swiss maestro unleashed three huge serves to kill off the contest, raising thunderous cheers from a sentimental crowd.
I'm much higher than I was last year. I have confidence in my movement and it's a game of movement out there these days," said the Swiss.
"I'm just happy to be playing back out here healthy," Federer said, looking forward to his clash with top seed Nadal.
"It's going to be a good match, it's going to be brutal and all those things ... Looking forward to slugging it out with him in a couple of days."
- Sports & Recreation