Federer beat his Swiss compatriot to become the oldest winner of the BNP Paribas Open title in California. His ranking goes up to number six in the world as a result.
The 35 year-old Federer beat Stan Wawrinka in two sets, 6-4, 7-5 in the California desert on Sunday.
"It's been just a fairytale week once again," Federer said after the match. "I came here for the first time 17 years ago. So to be here again as the champion is an amazing feeling."
Federer hit ten winners in the opening set, including a trademark single-handed backhand rocket in the first game.
Coming into the final, Federer had faced only one break point on his serve and Wawrinka managed just four points while returning in the first set.
In the tenth game of the first set as Wawrinka was serving at 30-30, Federer drew a forehand error for a set point and then Wawrinka overhit another forehand to lose the set.
Wawrinka broke Federer at the start of the second set but his lead was short lived. The Basel native broke back and won the next three games before breaking Wawrinka's serve again in the 12th game to take the match.
In all, Federer hit 23 winners, including 16 off his backhand in the 80-minute match.
After the final, Wawrinka apologized. "I'm sorry. I'm just tired after 10 days, so, sorry," he said.
It was Federer's 90th tour-level title and his 25th ATP World Tour Masters 1000 title. At 35 years, he is the oldest Masters 1000 champion since a 34-year-old Andre Agassi won the Cincinnati title in 2004.
After six months out of the game last year with an injury Federer started the year ranked 17th in the ATP world rankings. He moves up four places to 6th when the latest rankings are published on Monday.
All-Russian women's final
In an all-Russian women's final, Elena Vesnina defeated Svetlana Kuznetsova in three sets 6-7, 7-5, 6-4. Kuznetsova led 4-2 in the third set before Vesnina broke her twice to take the last four games of the match.
Vesnina made 46 winners and 49 unforced errors during the 3 hour match.
The 30-year-old Vesnina lost in the first round of qualifying last year, although she has won three doubles titles at the tournament. On the way to the final she beat both Germany's Angelique Kerber and Venus Williams.
The 31-year-old Kuznetsova was playing her third final, after finishing runner-up in both 2007 and 2008.
jm/av (AFP, AP)