The 33-year-old Swiss, a five-time champion here, will play for a spot in his second Masters 1000 final in as many weeks on Saturday against Canadian fifth seed Milos Raonic, a winner over Italy's Fabio Fognini 6-1, 6-0.
Second seed Federer took 93 minutes to storm to victory after trailing 4-1 in the second set.
Federer is bidding for the 80th title of his career. The Wimbledon finalist has now won 16 of his last 18 matches after playing last week's Toronto final.
"I deserved that first set. In the second I lost a little rhythm and everything got tougher for me.
More From This Section
"I got a little down on myself after the second break but I knew it's not been so easy for him to close out matches. I stole that second set in the end."
Federer won four second-set games to take a 5-4 lead after winning the opening set. He then earned a match point on the Scot's serve in the next game, clinching the victory from a Murray forehand into the net.
Federer owns a 5-0 record over Raonic, with their last meeting coming at Wimbledon.