Roger Federer beats Novak Djokovic at 2019 ATP Finals in London
Roger Federer moved into the ATP Finals last four at the expense of Novak Djokovic with a scintillating win over his great rival at the O2 Arena.
Swiss third seed Federer, 38, won 6-4 6-3 in a round-robin match which eliminates the Serb second seed from the season-ending tournament in London.
Federer will meet top seed Rafael Nadal or Stefanos Tsitsipas in the last four.
Djokovic's defeat also means Spain's Nadal is guaranteed to finish as the year-end world number one.
Nadal, 33, is far from certain of reaching the last four himself, needing victory over Greek sixth seed Tsitsipas on Friday to have any chance.
However, if German seventh seed Alexander Zverev beats Russian fourth seed Daniil Medvedev then Nadal is out regardless of his result.
If results do go his way then Nadal will top the Andre Agassi Group and face Federer - who has finished second behind Austrian fifth seed Dominic Thiem in the Bjorn Borg Group - in Saturday's semi-final.
Six-time champion Federer, who lost his opening match to Thiem, jumped for joy after clinching a victory which goes some way to avenging his defeat by Djokovic in an epic Wimbledon final in July.
Asked what he did differently at the O2, Federer said: "I won match point, I guess. It was so close at Wimbledon. It was a privilege to play that match, so many ups and downs.
"I couldn't be more happy right now. I think I served great, had great anticipation, clear game-plan and it worked great tonight - hopefully not for the last time against Novak."
Federer dominates battle for survival
Anticipation for the first meeting between the pair since that enthralling Wimbledon final was high as they met on the other side of the English capital in a situation which few would have predicted before the tournament.
When the draw was made last week, most expected their final round-robin match to be a decider for who would top the group.
Yet both players came into it fighting for survival after Thiem blasted them off the court to earn back-to-back wins which assured the French Open finalist of a last-four spot at the O2 Arena for the first time.
Federer was the one who produced a high-quality performance at the crucial time, with Djokovic looking out of sorts and nursing an elbow injury in the final stages.
Federer dropped just three points on his serve in the first set, firing eight aces and winning all points behind his second serve, as even Djokovic's famed defensive game could not cope with his accuracy.
While this victory will not completely make up for that bitter defeat at SW19, which denied him a 21st Grand Slam triumph, Federer's delight at avenging it was clear.
Federer missed two championship points before going on to lose Wimbledon's longest singles final in a historic final-set tie-break, but ruthlessly took his first opportunity here as Djokovic disintegrated.
'There was not much I did right' - Djokovic
Djokovic, 32, had won his four previous matches against Federer but, apart from a brief spell at the start of the second set, rarely looked like testing the Swiss.
The reigning Australian Open and Wimbledon champion only created one break point, which Federer saved in the fourth game of the second set, and won just seven more points from that moment.
With defeat looming, Djokovic quickly became ragged as Federer swept past him to win four of the final five games.
As well as missing out on ending the year as world number one, defeat also means four-time champion Djokovic failed to reach the semi-finals here for the first time since 2011.
"There was not much that I did right this match, to be honest. Realistically he was better player in all aspects and absolutely deserved to win," Djokovic said.
"He served great, moved well, returned my serve very well. From his end, I think he did everything right.
"From my end, I was just playing too neutral. I couldn't read his serve well. Just a pretty bad match from my side."
Afterwards Djokovic played down the significance of the elbow injury, which occurred when he stretched for a return at the baseline in the second game of the second set.
The Serb said he hopes he will be fit for next week's inaugural Davis Cup finals in Madrid.
"The pain was pretty sharp but I could play the rest of the match," Djokovic said.
"If I had something really serious I think I wouldn't have been able to hold a racquet. It did not pose any issues later on."
BBC tennis correspondent Russell Fuller
Djokovic says Federer is a role model even for him - and amid the pain of losing, he was able to appreciate a vintage performance from the 38-year-old.
When Federer serves like he did in the first set, no-one who can live with him: even if Djokovic did invite some of the pressure on himself, by sending down three double faults in his first service game and a half.
Once broken in the second set, Djokovic cut a dejected figure who sensed his number was up, as Federer continued to glide rapidly around the court.
His victory ensures Nadal will be the year end number one for a fifth time. Federer and Djokovic have also managed that five times. There really is so little to separate these three extraordinary players.