Federer, playing in his eighth Wimbledon final and 24th Grand Slam championship match, won 4-6, 7-5, 6-3, 6-4 to join Pete Sampras and William Renshaw as a seven-time champion.
The Swiss great, who has also regained the world number one ranking, is just the third man over 30 to win Wimbledon following Rod Laver in 1969 and Arthur Ashe in 1975.
Murray, 25, bidding to be the first British man since Fred Perry in 1936 to win Wimbledon, has now lost all four Grand Slam finals in which he has appeared.
But in the opening exchanges of this eagerly-anticipated final, he was the stronger player, making the most of his five-year advantage as Federer looked fatigued and ragged.
However, once the £80 million roof was shut in the early stages of the third set, as torrential rain bucketed down outside, the momentum shifted and Federer stormed into the ascendancy.
With the Duchess of Cambridge, sister Pippa Middleton, Australian great Rod Laver, British Prime Minister David Cameron and even the Beckhams looking on from the Royal Box, it was the Briton who started the stronger.
Murray, defeated by Federer in the 2008 US Open and 2010 Australian Open finals without winning a set, broke in the first game when an uncharacteristically nervy Swiss ballooned a drive volley and that break was backed up by a hold.
Federer held and retrieved the break, shrugging off the boozy call of 'I love you, Roger' from a male fan in the 15,000 crowd.
Murray survived two break points in the eighth game and made the most of the reprieve when he broke to lead 5-4 as Federer netted a forehand having had to take evasive action to avoid a Murray forehand missile.
The Scot then wrapped up the opener on an unreturned serve -- it was the first set Murray had won in his three Grand Slam finals, with Federer's 16 unforced errors to his opponent's five proving key.
Murray saved a break point in the second game of the second set while Federer, the first 30-year-old in the final since Jimmy Connors in 1984, saved two in the fifth.
The two men served a pair of love games as Federer led 4-3 while Murray wasted two break points in the ninth game as the six-time champion clung on for a 5-4 advantage.
The Briton again served a love game for 5-5.
But Federer held and suddenly carved out a set point with a magical drop volley in the 12th game which caused Murray to push a lob long.
Another immaculate drop volley off his toes gave him the set 7-5.
At 1-1 and 40-0 for Federer in the third, heavy rain drove the players off court for 40 minutes and the roof was closed.
In a dramatic sixth game, which lasted 20 minutes and went to 10 deuces, Murray took three tumbles to the ground, surrendered a 40-0 lead and Federer broke on a sixth break point for a 4-2 lead.
A ninth ace of the contest in the ninth game gave Federer the set 6-3 and a two sets to one lead.
Suddenly, the life and vibrancy seeped out of Murray.
He felt his lower back, Victoria Beckham looked even more sombre, and the Scot slipped 3-2 down off a killer, crosscourt backhand drive.
A 12th ace in the 10th game took Federer to two match points, the first of which was saved but Murray went wide on a forehand to hand Federer victory.
Story continues below…