This article is more than
6 year oldThe 31-year-old Serb, a five-time runner-up at the event, beat seven-time champion Federer 6-4 6-4.
Wimbledon champion Djokovic had lost the Cincinnati final to the Swiss on three previous occasions.
"It's a very special moment," he said. "It's the first time I get to stand with a winning trophy in Cincinnati."
Victory for world number two Federer would have brought him his 99th career trophy, as well as levelling the long-time rivals' head-to-head record at 23-23.
Djokovic will now look to take his form into the US Open, which starts on 27 August, having previously won two titles at Flushing Meadows.
Federer was under pressure from the start, saving two break points before holding to win the first game.
World number 10 Djokovic eventually broke his opponent's serve for 4-3 before holding to win the opening set.
But Federer started the second set the strongest, racing into a 2-0 lead before Djokovic fought back to level at 2-2.
He earned another decisive break at 4-3 before serving for victory on his first championship point in one hour and 24 minutes to complete a career 'Golden Masters'.
Federer said: "Congratulations to Novak for your amazing effort not just this week, but throughout your whole career, it is an amazing achievement.
"It's been a great week, tough on the players but we had a fun time."
Earlier, Kiki Bertens held off a championship point to upset world number one Simona Halep in the WTA tournament.
<p>A US judge has ruled against Donald Trump getting his hush money conviction thrown out on immunity grounds.</p>