You are not permitted to download, save or email this image. Visit image gallery to purchase the image.
The 25-year-old Briton had been two points away from a final against Novak Djokovic when serving at 6-5 in the fourth set only for Federer to force a tiebreak and then a decider.
Murray, however, has discovered a mental toughness in the last 12 months under coach Ivan Lendl and instead of brooding about losing the set the Scot sat quietly while Federer took a toilet break and figured out what he needed to do at the start of the fifth.
The focus worked and Murray raced out to a 3-0 lead then held on for a 6-4 6-7 6-3 6-7 6-2 win in four hours to set up the final showdown with world number one Djokovic on Sunday.
"To be honest, I was just trying to think what I'd done to get to that point, and I was just trying to focus on doing it at the beginning of the fifth set," Murray told reporters.
"You never know what's going to happen. The only thing you can do is play the right way, go for your shots when the opportunity's there, and hope that it pays off.
"You just need to try and be focused for as much of the match as possible (and) the beginning of the fifth set was the part of the match that I was most pleased with."
Murray is one of the few players to have a winning career record against Federer but had faced him three times in grand slams and lost each match.
He managed his first victory over the 17-times grand slam winner on the big stage when he beat him on grass at Wimbledon in the 2012 London Olympic final.
It proved to be a victory that helped springboard Murray to his first grand slam title at the U.S. Open, where he overcame Djokovic in five sets.
While happy to have beaten Federer for the first time at a grand slam tournament, Murray was more pleased with the way in which he had won.
"It's satisfying obviously. I've obviously lost some tough matches against him in slams," Murray said. "So to win one, especially the way that it went tonight, was obviously nice.
"I thought I did a good job. I think I did all the things I needed to do. I did them well.
"Even after the second and fourth sets, which were tough to lose because I wasn't comfortable, but I was in good positions in both sets.
"I was just happy with the way I responded after both those sets," he added.
While Murray and Djokovic appear set for a rivalry like Federer and Rafa Nadal's, Murray said there was still life in the 31-year-old Swiss.
"I wouldn't say I dominated the match - didn't necessarily feel that way," Murray said.
"I obviously had more breaks of serve and stuff by the end. Because of that I assume I probably would have won significantly more points (and) really at no stage was I behind in the score.
"But he obviously hung in extremely well to force it into a fifth set.
"After the way the match had been going, it was great the way he turned around because he played some big points when he was behind.
"It's what he always does."