Federer ended a week of uncertainty about his aging back with a vintage performance to give Switzerland an emphatic victory over France and its maiden Davis Cup.
His 6-4, 6-2, 6-2 victory over Richard Gasquet in the first reverse singles on Sunday sealed an unassailable 3-1 lead. That also proved to be the final result as the dead rubber between Gael Monfils and Stan Wawrinka wasn't played.
It took 15 years for the former top-ranked Federer to achieve Davis Cup success after making his debut in the event in 1999. No wonder he looked so emotional after converting his first match point, falling to his knees and lying face down on the court before hugging team captain Severin Luthi and his teammates.
"At the end, it's a tennis match, you feel great emotions. You're unbelievably happy and relieved," said a joyful Federer. "We wanted this clearly very badly, especially being up 2-1. You inch yourself closer and closer. Clearly seeing Stan out there, the rest of the team supporting you, gives you an extra push. It was definitely one of the better feelings in my career, no doubt about it. So much nicer to celebrate it all together."
After pulling out of the final of the ATP World Tour Finals in London last Sunday, Federer's participation against the French looked in doubt. He hit a ball for the first time on the indoor clay court on Wednesday evening and was a shadow of his former self when he was thrashed by Monfils in Friday's singles.
His form rapidly improved, though, and he was back to his best during Saturday's doubles win with Wawrinka that gave the Swiss a 2-1 lead.
Federer, who adopted a low profile all week, was full of praise for Wawrinka.
His teammate stepped out of Federer's formidable shadow earlier this year with victory at the Australian Open. He has also been a dedicated Davis Cup player in recent years, while Federer often focused on his personal career.
In 2013, Wawrinka led Switzerland to victory in a World Group play-off in the absence of Federer, giving his country a shot at the trophy this year. He also won Switzerland's first point this weekend by beating Jo-Wilfried Tsonga.
"Stan has put in so much effort over the years and played an unbelievable weekend that gave me the opportunity today," said Federer.
"I'm very much aware of that, this one is for the boys. It's not for me. I've won enough in my career and did not need to tick any empty boxes. I'm just happy for everybody else. I'm happy we could live a great tennis historic moment in our country."
Federer, who spent 302 weeks at the top of the game, shed a few tears before receiving his trophy and enjoying a lap of honour with his teammates. But emotions were not as strong as they were when he won his first Grand Slam title in Wimbledon in 2003.
"You can't compare. When I won Wimbledon, it was a total shock honestly," he said. "Davis Cup is something that I knew was possible at some stage in my career.
"Of course, there was the pressure of being able to manage all this and make everyone happy with all the support we had for the team and everything. So it is a totally different feeling. Also I was not alone on the court. This changes everything."
A favourite of the fans at the French Open, Federer was treated to a hostile reception as he entered the clay court in the converted Pierre Mauroy football stadium on Sunday.
He was booed during his warm-up and large sections of the 27,448 spectators applauded his rare mistakes.
It did not prevent him from taking control right from the start. The Swiss hit an ace that travelled at 210 kph (130 mph) to win his first service game and never looked back.
Moving well and varying his backhand shots, Federer gave a tennis masterclass. Gasquet was overwhelmed in the rallies and struggled to read his opponent's serve throughout.
"He was not unbeatable today, but he only made a few mistakes," said Gasquet, who replaced the injured Tsonga. "It's a shame I could not get any break points."
Federer broke in the third game after hitting a subtle forehand half-volley and a stunning forehand passing shot, letting out a resounding "Come On!"
He kept piling the pressure on his French rival with aggressive returns and closed out the set by holding at love, having lost just four points on his serve in the whole set.
Gasquet was made to pay for his mistakes at the start of the second set and handed another break to Federer when he netted a backhand in the net. The Frenchman gave an incredulous look when Federer hit a superb backhand return to reach 0-30 on Gasquet's serve in the seventh game before earning three break points with a stunning forehand. Gasquet saved the first, but went long on the second.
The 26th-ranked Frenchman fought hard at the start of the third set and came more often to the net, only to be destroyed by Federer's pinpoint passing shots.
Gasquet finally dropped his serve for the fourth time in the fifth game, surrendering on his backhand after a baseline rally before Federer broke again for a 5-2 lead. Federer then held at love, sealing victory with a drop shot that Gasquet did not chase.