The 17-time Grand Slam champion gave Switzerland its first title in the team competition and added the only big trophy in tennis missing from his collection.
The 33-year-old Federer and Stan Wawrinka had put Switzerland into a 2-1 lead Saturday with a straight sets defeat of Gasquet and Julien Benneteau in the doubles.
Federer was thrashed by Gael Monfils in his first singles match after struggling with a bad back but recovered as the weekend progressed and did not face a break point on Sunday.
"I'm happy I was able to stay calm and play a good match, and I'm really happy for the guys in the team, everybody worked incredibly hard to get me match ready," Federer said. "Stan has put in so much effort over the years and played an unbelievable weekend that gave me the opportunity today. I'm very much aware of that, this one is for the boys."
It took 15 years for the former top-ranked Federer to achieve glory in the Davis Cup after making his debut in the prestigious event in 1999. He fell on his knees after converting his first match point and laid face down on the court before hugging team captain Severin Luthi and his teammates.
"It's not for me, I've won enough in my career and did not need to tick any empty boxes," Federer said. "I'm just happy for everybody else. I'm happy we could live a great tennis historic moment in our country."
A favorite of fans when he plays at the French Open, Federer was treated to a hostile reception as he entered the clay court in the converted Pierre Mauroy football stadium. He was booed during his warm-up and large sections of the 27,448 spectators applauded the rare mistakes he made.
That did not prevent him from taking control of the match from the start. The Swiss hit an ace that traveled 130 mph to win his first service game and never looked back.
Moving well and varying with his backhand, Federer gave a tennis masterclass to Gasquet, who 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 Jo-Wilfried Tsonga. "It's a shame I could not get any break point."
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 pressure on his French rival with aggressive return games 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 move 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 to stay in the match by trying to come more often to the net, only to be destroyed by Federer's pinpoint passing shots.
Gasquet finaly dropped his serve for the fourth time in the fifth game, cracking on his backhand after a baseline rally before Federer broke again for a 5-2 lead. The Swiss then held at love, sealing victory with a drop shot that Gasquet did not chase.
Federer, Switzerland Win Davis Cup
ESPN the Magazine senior writer Howard Bryant discusses Roger Federer's 6-4, 6-2, 6-2 win over Richard Gasquet to clinch the Davis Cup title for Switzerland.