Federer clinched it on his third match point with an ace to set up a showdown with top-ranked Rafael Nadal, who beat Grigor Dimitrov 3-6, 7-6 (3), 7-6 (7), 6-2.
Two of the leading contenders on the men's side survived on a day when two-time defending champion Victoria Azarenka was beaten 6-1, 5-7, 6-0 by Agnieszka Radwanska in the women's quarterfinals.
Still, Nadal and Federer certainly had nervous moments.
Murray, who saved two match points in the third-set tiebreaker, has an 11-10 edge over Federer in head-to-head matches and won their last match in five sets in the Australian Open semifinals last year, but Federer has won four of five matches in majors.
The Wimbledon champion became agitated after a ruling while dropping serve late in the third set when he indicated that he thought the ball had bounced twice before Federer kept it in play.
Rightly or wrongly, it seemed to spark his resurgence, breaking Federer when the 17-time major winner was serving for the match in the 10th game, and then pushing it to a fourth set when he won six of the last seven points in the tiebreaker.
"They showed it twice on the replay," Federer said of the bounce. "It's an umpire's call. It looked good."
After spending three months off the circuit following minor back surgery, Murray appeared to be in discomfort at times in the match, clutching at his lower back.
"I was proud of the way I fought," Murray said. "That's the highest level I've played at in a long time. My serve slowed down a bit in the fourth set, especially the first couple points when I was getting up after the change of ends."
After Federer won the opening game of the fourth set, the two played a 10-deuce game in which Murray saved six break points before Murray levelled. But Federer finally broke Murray in the eighth game then held serve to win the match in 3 hours, 20 minutes.
"I'm back," Federer said. "It was a great game on many levels, not just physically ... but mentally, also."
In the earlier match on Rod Laver Arena, Nadal received treatment several times for a nasty-looking blister on the palm of his left hand that he said caused him to serve slower than usual. He fended off three set points in the third, including two in the tiebreaker, and won on his first set point.
He went up 2-0 in the fourth when he hit a passing backhand down the line on break point with Dimitrov standing at the net. At the end, Dimitrov appeared to wipe tears from his eyes with a towel as he walked off Rod Laver Arena.
Nadal acknowledged that Dimitrov let him off the hook with a wide forehand on set point in the third-set tiebreaker.
"It's a tough moment mentally for an opponent," Nadal said. "If that forehand from him goes in and he wins the third, I'm going to be fighting."
Dimitrov said: "I'm a bit shattered. I came out expecting nothing less than to win."
Azarenka's loss meant both defending champions went out in the quarterfinals — Novak Djokovic lost to Stan Wawrinka on Tuesday, ending his bid for a fourth consecutive men's title. Azarenka had been aiming for three in a row and other women's title contenders Serena Williams and Maria Sharapova didn't even reach the quarterfinals.
Azarenka's defeat left 2011 French Open champion Li Na as the only major winner in contention. Li, a two-time Australian Open finalist, next plays 19-year-old Canadian Eugenie Bouchard. In the other semifinal, Radwanska takes on No. 20 Dominika Cibulkova, who routed No. 11-seeded Simona Halep 6-3, 6-0.
Radwanska mixed up her game cleverly to keep Azarenka off balance, and never let her settle into the game.
"She was aggressive. She was making everything. She was guessing right," Azarenka said. "I was just playing a little bit too predictably."
Warwinka plays Tomas Berdych in the first men's semifinal Thursday, with Federer and Nadal set to play Friday night.
"We've had some epics over the years," Federer said of the semifinal. "I hope we can slug it out here in a couple of days."