before the Swiss struck three aces and an unreturnable serve to hold serve in only 47 seconds to go ahead 5-3.
Djokovic held serve to reach 5-4 before striking two groundstroke errors to trail 0-30 with Federer serving for the set.
At 30 all, Federer hit a forehand volley winner followed by an ace down the tee on set point to take the opening set after only 38 minutes of play.
The Swiss continued his very high level of play early in set two as he struck a forehand down the line winner with Djokovic serving at 30-40 to break serve to lead 1-0.
Following three holds of serve, Djokovic served down 1-3. The Serbian then held serve to reach 2-3; surviving a three deuce game after Federer struck two forehand errors to end the game which lasted eight minutes.
Both players then held serve which put Federer ahead 4-3.
With the Swiss serving at gamepoint, Djokovic hit a crosscourt forehand volley winner to pass Federer who was also at the net to reach the fifth deuce of the game.
However the Serbian then netted a crosscourt backhand slice before striking another crosscourt backhand long as Federer held serve to lead 5-3 after an eight minutes long game.
Serving to stay in the match, Djokovic saved two matchpoints before holding serve to reach 4-5 following two Federer backhand errors in a game which lasted six and a half minutes.
With his coach the German and former Wimbledon champion Boris Becker looking on from the stands, the Serbian had hit a down the line backhand volley winner to save matchpoint one before striking an ace down the tee to save matchpoint two.
Serving for the match, Federer hit a forehand volley winner to lead 15-0.
Djokovic then struck an overhead winner to reach 15 all before powering a forehand down the line for a winner to lead 15-30.
However on this day, Federer could not be stopped as he would unleash three stunning winners to end the match: an inside out forehand down the line winner followed by an ace down the tee and then a final crosscourt backhand volley winner on matchpoint.
After one hour and 35 minutes of play, Federer had snapped Djokovic’s 28 match winning streak in China after winning in an impressive 20 of the 35 times he’d ventured to the net.
“I think I did not play too bad,” said Djokovic. “It’s just that he played everything he wanted to
play. He played the perfect match. I think he’s going to tell you how he felt,
but that’s how I felt he played. He played an amazing match.”
The Swiss now leads Djokovic head to head 19-17 in career ATP Tour matchups.
“It was a great match, I agree,” said Federer, who has a chance to finish 2014 atop the ATP Tour rankings. “I think I played very well. There was nothing in the game today that
wasn’t working. I think it was a high level match. I’m unbelievably happy with the way it went.”
Federer, who did not lose serve once in the match while striking 35 total winners, takes on the unseeded 29th ranked Gilles Simon of France in Sunday’s final round match at 4:30pm Shanghai time Sunday (1:30am PST USA).