The 34-year-old Swiss took special pride in the two-hour victory after last beating Nadal three and a half years ago.
The Basel native improved to 11-23 in the series which defined men's tennis for a decade.
“This was my best victory in Basel, considering everything I've done throughout my career here,” said Federer, playing in a record tenth consecutive trophy match at his local venue, where he began as a ballboy two decades ago.
“It was a big match for me, probably more than for him,” Federer said.
“After all the matches and big finals we've played over the years, to have a final here in Basel was amazing for the crowd and for me personally,” he said.
“To come through and win was very special.”
Federer said the match was close.
“I think I had a bit more of it throughout, I had chances in the second set but he fought back well like he's done throughout the week,” he said.
“I had some closer moments in the third set, overall I was pretty happy how I played.”
Federer and Nadal last met in the Australian Open semifinals nearly two years ago and played their last final in Rome in 2013.
Sunday's win was Federer's 88th career title while taking his season record to 58-9.
“I had a good game plan today, everything worked out,” the world number three said.
“There were no real surprises there, I was match-ready.”
The win at the St Jakobshalle gave Federer his first victory over Nadal since the semifinals of the 2012 Indian Wells Masters, and ended a five-match winning streak by the Spaniard.
Nadal had won 14 of their previous finals, with Federer claiming six.
But the Swiss has now improved to 5-1 against Nadal on indoor surfaces.
Nadal was still pleased with his own effort this week.
“A few small things made the difference, like one game in the third set (when he was broken for 3-5),” the 29-year-old said.
“I was not very far away,” Nadal said.
“He played too well and I didn't play bad either,” he said.
“It was a positive final for me — I lost but I was very close to the win.”
Top seed Federer got away to a good start, earning a break for 3-2 and concluded the opener with a second break to take the lead after 37 minutes.
But Nadal, who has been making comebacks all week, was having none of it.
With Federer on a roll, the Swiss won the fifth game with three aces and fired his ninth ace to secure a 5-4 lead.
Nadal earned a break point in the next game and converted to shock the Swiss with a 6-5 lead.
The Spanish third seed quickly levelled the match at a set each on the first of three set points.
Federer came alive just in time in the final set, breaking for 5-3 and serving out victory a game later on his second match point after two hours.
Basel is the fifth tour event at which Federer has won at least seven times.
He has eight titles on grass at Halle, Germany, his all-time best.