Djokovic is on a 22-match winning streak and will aim to move level with Rafael Nadal on a record 33 Masters titles.
"Novak is obviously on a roll. You can feel it," Federer said. "He protects his serve very well."
Earlier, Khachanov continued his strong recent form by beating Dominic Thiem 6-4, 6-1. Khachanov won the Kremlin Cup in Moscow last month for his third career title.
Djokovic, who beat him on the way to the Wimbledon title, is seeking a record-extending fifth Paris Masters and 73rd title overall.
He was made to work far harder than when he beat Federer in the Cincinnati Masters final in August and his relief was evident.
When they hugged at the net, Federer gave Djokovic a pat on the chest and then walked off quickly, raising a thumb to the crowd as fans roared their approval.
They 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.
Brilliant one-handed winners on the run from Federer down the line and acute-angle volleys at the net; astonishing elasticity while retrieving from the baseline and laser-beam forehands to the corners from Djokovic.
Federer had 17 aces, while Djokovic got five of his eight in his last three service games of the match, stepping up his level at the right time.
Djokovic briefly let his volatile temper get the better of him, though, when he had Federer 15-40 down in the ninth game of the deciding set. Federer saved both break points, and Djokovic whacked his racket into the ground, drawing the first and only boos of a titanic match.
Djokovic jogged over to get a new racket and held his hands up as if to apologise to the unforgiving crowd, unhappy that a pique of rage interrupted their gourmet feast of tennis.
Brimming with confidence in a season which has seen him go from No 22 in the rankings in May to No1 when released today, and in which he has added the Wimbledon and US Open to his grand slam haul, Djokovic created pressure throughout.
But Federer saved every break point - 12 of them - and secured the only break of the match in clinching the second set.
The shot of the match went to Federer in the eighth game. As Federer charged to the net, Djokovic hit a powerful forehand which clipped the net and flew to the left of Federer, wrong-footing him. From a seemingly impossible angle, and totally off balance, he scooped his racket behind his neck and flicked a volley over the net for a winner.
Federer thrust his arms into the air, the crowd rose to their feet in sheer disbelief. Even by Federer's lofty standards, it was remarkable.
But after losing the match, Federer was left shaking his head. He was unhappy someone in the crowd twice shouted "out" during the match-point rally.
"It's just unfortunate it happens, and at the end, you lose the point, the match," Federer said.
Still, he retained a sense of irony.
"Thank God the rally ended," he said. "It would have been five times if it continued."
- AP