This marked the seventh consecutive year — 11th time in 13 years — that Federer or Djokovic won this title.
The only other tournaments Federer won seven times are Wimbledon, and Halle, Germany, both on grass.
"Ever since I won here the first time, I fell in love with the tournament," Federer said. "The seventh is quite unbelievable. It sounds pretty crazy to me."
Federer, who has 84 career titles, won in Brisbane, Australia, in January.
"He deserved it," Djokovic said. "I expected that from him.
"I knew he was going to chip and charge, come to the net, serve and volley."
The 5,000-seat stadium was sold out, but many more people were standing around at the top. They were treated to a high-caliber match.
Federer needed five more aces to become just the fourth player since 1991 to serve 9,000 career aces. He served 12 in the final.
He joined Goran Ivanisevic (10,183), Ivo Karlovic (9,375), and Andy Roddick (9,074) in cracking the 9,000 aces mark.
"I even remember which one it was because I was counting them," Federer said. "It was one of the swinger wides.
"It's nice to get past that so I don't have to think about it ever again, or until the next thousand or so."
Federer saved all seven break points he faced, while Djokovic lost both break points he faced.
Djokovic sailed a backhand long on break point in the eighth game of the first set.
In the second set, Djokovic had a 40-0 lead in the 11th game, but watched Federer rebound to break his serve with an inside out forehand crosscourt winner.
"The first set belonged to me, but the second set belonged to him more, really," Federer said. "It was a huge game at 5-all, 40-love for him.
"I crawled my way back into that game and ended up breaking him," Federer added. "That was big but the break points I saved were even bigger."