"I couldn't be happier to finish the season like this".
The Serbian started strongly and secured a quick break of serve to go 3-1 up before the momentum shifted.
Djokovic seemed agitated at times and twice turned to his box to remonstrate about an unspecified issue during the first set. In the 2013 semifinals, he bounced back from a set down to beat the Swiss, 4-6, 6-3, 6-2.
The only previous time they had met, Djokovic crushed the Russian in straight sets at Wimbledon and, briefly, it seemed as if the same fate could await Khachanov again as he was out-rallied to go 3-1 down in the opening set.
Federer saved two break points in the first game of the third set, and both players held relatively comfortably to send things into a decisive breaker. "He can really hurt you", Djokovic said.
Federer thrust his arms into the air, the crowd rose to their feet in sheer disbelief.
"For the most part I can be happy, my level was good, but losing is never fun", said Federer.
"I'm getting into the season finale with a lot of confidence and feeling good about my game".
Swiss third seed Federer, chasing his 100th career title at the age of 37, said: "Novak is obviously on a roll - you can feel it".
Fourteen-time Grand Slam champion Djokovic, 31, will still overtake Rafael Nadal at the top of the world rankings on Monday.
"I'm satisfied of course and I'm going to be No. 1 tomorrow officially". "I told him to tell him to keep it down a little bit because he was going a little bit too much over the edge".
Djokovic's elevation is remarkable as it comes just five months after he slumped to 22nd in the world - his lowest ranking for 12 years - when he was knocked out of the French Open in the quarter-finals.
The 31-year-old, now unbeaten in 22 matches, is a four-time victor of the Paris Masters. Marat Safin won it three times before that. "High quality tennis", Djokovic told reporters. "I'm just really proud of myself that I could be in this list of winners".
He improves to 4-0 in ATP World Tour title matches, having also lifted trophies in Marseille and his home capital of Moscow this year.
Fans got everything they could have hoped for- Two players with a combined 34 Grand Slam titles, 59 Masters titles, and 533 weeks at No. 1 slugging it out at a level of unrelenting yet sublime intensity.
"I think that was the problem with Kei today".