(CNN) -- Roger Federer secured a record-equaling seventh Wimbledon title to dash the hopes of Andy Murray and a partisan Centre Court crowd.
Federer made it 17 grand slam titles to his name after a two-and-a-half-year drought and matched the haul of American Pete Sampras at the All England Club.
The Swiss will return to the top of the world rankings as a result of his 4-6 7-5 6-3 6-4 victory, meaning he will match his hero Sampras' record of 286 weeks at No. 1.
For Murray, the first Briton to reach a men's singles final at Wimbledon in 74 years, it represented his fourth defeat in major finals, and his pain was acutely felt by a fervent crowd at Wimbledon.
Federer's triumph was his first at Wimbledon since 2009, with his last major win coming at the Australian Open in 2010 when he also beat Murray.
"It's amazing," Federer told the host broadcaster. "It equals me with Pete Sampras, who is my hero, so it feels amazing.
"I think I played some of my best tennis in the last couple of matches. It's worked out so many times here that I play my best in semis and the final. I couldn't be more happy -- it feels being great being back here as the winner. It's a great moment."
Federer's victory means he is only the second player in the men's game to have held the top ranking over the age of 30, alongside Andre Agassi.
"As we know, the world No. 1, you don't get that gifted," he added. "I was up two sets to love in the quarters last year, two sets to love up at the U.S. Open ... so many chances, maybe I got nervous, maybe the other guys were just too good.
"I never stopped believing and I started playing more even though I have a family and it all worked out, I got great momentum and confidence and it all came together. It's a magical moment for me.
"I've obviously gone through some struggles as well, a lot of changes have happened in my life since so this one comes at the right time, as any grand slam victory."
Murray had started well, spurred on by a fervent home crowd desperate to see a first British winner in the men's singles since Fred Perry in 1936, breaking Federer in the very first game.
And though the 25-year-old then lost his own serve, he summoned another break to take his first set in a grand slam final.
As a tense second set neared its climax, Federer then executed two perfect drop shots to stun Murray and take it 7-5.
The third set was locked at 1-1 when a heavy burst of rain arrived, forcing the players off court as the recently installed roof was closed.
The change in atmosphere played into Federer's hands as he reappeared rejuvenated. An epic sixth game of the set lasted for 20 minutes and 10 deuces as Murray desperately tried to cling on to his serve.
But once Federer secured the break he quickly finished the set and then broke for 3-2 in the final set, sinking to the turf as a cross court forehand from Murray handed him his seventh title.
Afterwards, a tearful Murray joked: "I'm getting closer. I'd like to congratulate Roger. I was getting asked the other day after I won my semifinal, was this my best chance because Roger is 30 now? Well, he's not bad for a 30-year-old.
"He played a great tournament. He showed what fight he still has in him. So, congratulations Roger you deserve it."
Murray saluted the fans who offered him such support throughout the tournament, and remarked on the pressure that comes with carrying a nation's hopes of finally ending a 76-year British wait for the men's title.
Expectations had been raised even higher after Jonathan Marray became Britain's first men's doubles champion at Wimbledon since 1936 on Saturday.
"Everyone always talks about the pressure of playing at Wimbledon but it's not because of the people watching," Murray said. "They make it so much easier to play. The support has been incredible so thank you."