The 23-year-old from Scotland overcame several rain delays to become the first man to repeat as champion since Andre Agassi in 1995. He beat world No. 1 Rafael Nadal in the semifinals.
"Winning a tournament is always great," Murray said. "This is the first time I've beat Roger and Rafa in the same tournament, which is probably the most pleasing thing. And I didn't drop a set against either of them -- so it's good for the confidence for the next few weeks."
The players last met in the Australian Open final, an easy win for Federer that gave him 16 Grand Slam titles, most in tennis.
Rain delayed the start of the match by 15 minutes, and when play finally began, Murray seemed intent on blasting Federer from the stadium before fans could dry their seats, breaking Federer twice in the first 10 minutes.
"I thought he played well," Federer said. "He wasn't giving me much and he clutch-served at the very end when he had to. He deserved the victory."
Federer's last action before this tournament was his quarterfinal loss at Wimbledon. He even worked with a coach, American Paul Annacone, and declared he would "love to win another 10 Wimbledons, another five French Opens, an Olympic gold in London, a Davis Cup and whatever -- you name it."
After being held to only two points through the first two games on Sunday, Federer broke back to get to 3-1 and climbed all the way to 5-5 when Murray double-faulted his way to a break. But Federer lost his own serve before Murray served out.
Murray was on serve with Federer up 2-1 in the second set when another rain delay happened, this one more than 45 minutes. Murray held serve to level the second set at 2-2 when the chair umpire called the two men back to their umbrellas just moments after play resumed.
A storm rolled in just after 4 p.m., causing about an hour-long delay. Federer perked up briefly when play resumed, but eventually Murray's serve was too much, and the Swiss superstar hit his final return long to end it.
"The rain delays completely kind of shut it down for me to get any kind of rhythm," Federer said. "It was played at a couple of points here and there. It didn't even feel like the end of the match, you know? All of the sudden, it was all over."
The tournament had the top four players in the semifinals. Federer beat Novak Djokovic and Murray beat Nadal.
"I felt pretty good this week, and I prepared well for the tournament," Murray said. "I just wanted to go for my shots more this week, you know, play the way that I felt like playing and it definitely worked."