However, the 31-year-old served out for the title, maintaining his record of not dropping serve during the week and becoming just the third player to win a Masters 1000 event without getting broken.
"I'm just cherishing that achievement and every moment spent on the court".
The 37-year-old Federer was forced to battle through the first two matches of his title defence, first to Daniil Medvedev and then Roberto Bautista Agut.
Djokovic dominated opponents behind his powerful serve, winning all 47 of his service games during the tournament. The fourth seed, who is yet to win a Grand Slam despite his undoubted talent, angrily threw his racquet at the start of the second set as Djokovic ramped up the pressure.
"I could not ask for a better scenario", Djokovic, who last sat atop the rankings two years ago, said of his late surge to the summit of men's tennis.
The Croatian stunned the 20-time Grand Slam champion 6-4, 6-4 in what was an unusually error-strewn performance from Federer.
He is desperate to take injured Rafael Nadal's number one spot before the year is out, and on this evidence, he will.
"I wish I could tell you all these answers, but I really don't know".
He has now won 18 straight matches, including the titles at Cincinnati and the US Open.
"He (Zverev) has improved a lot, and he has established himself as a top player", Djokovic said.
The 6-4, 6-4 victory over the 11th-seeded Briton seals Zverev's place in the season-ending ATP Finals in London next month, which bring together the top eight men.
The hugely promising 21-year-old had knocked out Juan Martin del Potro and Roger Federer in the opposite side of the drawer but had no answer to Djokovic.
"I wouldn't be so dedicated to this sport if I didn't believe that I can achieve great heights", Djokovic said.
"I am very close now to Nadal in the rankings and put myself in a good position for the last period of the year".
So I'm happy about that.' Federer will now play the Swiss Indoors in Basel in a week.