It was the 50th act of one of the greatest rivalries of the sport and the odds were heavily stacked against Federer as the Swiss had not beaten the Serb at a major since their 2012 meeting on the grass courts of Wimbledon.
Federer’s journey on the blue courts of Melbourne Park had also been far from smooth as he was two points from losing against John Millman in the third round and then saved seven match points to get past American Tennys Sandgren in Tuesday’s quarter-final - when he also struggled with a groin strain.
In contrast, Djokovic had won his last four matches at a canter.
He lost his only set of the Australian Open in the opening match against German Jan-Lennard Struff.
But it was the 20-time Grand Slam winner who got out of the blocks briskly on a hot evening to wrest early initiative as Djokovic struggled with his service games.
Federer was up 4-1 and 40-0 on Djokovic’s serve but the Serb managed to save all three breakpoints to win his first service game as his opponent made an array of unforced errors.
The Swiss, who had to take a lengthy medical timeout against Sandgren for a groin problem, was not keen on engaging Djokovic in rallies and hit an incredible 26 winners in the first set.
But the count of his errors also started creeping up as Djokovic regained control to get the contest back on serve and then took the set with an imperious display in tiebreak.
“It could have definitely gone a different way if he used those break points,” Djokovic, who beat Rafa Nadal in last year’s final to grab his seventh Australian Open title, said.
“He started off really well, I was pretty nervous at the beginning.
“Respect to Roger for coming out tonight, he was obviously hurt and wasn’t at his best or even close to his best in terms of his movement.”
Both players received medical attention at the end of the first set, with Djokovic calling the trainer to get his knee massaged.
That appeared to have the desired effect for the second-seeded Serb as he raised his game up a notch to convert his fourth breakpoint chance with a forehand winner at the net to grab the second set.
Djokovic kept up the pressure on the 38-year-old Swiss legend in the third set and the crucial break came for him in the sixth game with a forehand groundstroke winner for a 4-2 lead.
The 32-year-old, winner of 16 Grand Slam titles, sealed his 27th win over Federer with his first match point when the Swiss found the net with a backhand for his 35th unforced error of the night.
While Federer totalled 46 winners in the match compared with the Serb’s 31, he had 17 more unforced errors.
“I was playing with nothing to lose obviously,” Federer said after losing for the 11th time in 17 slam meetings with Djokovic.
“I was just trying to take big cuts at the ball, trying to keep the rallies to a minimal, make sure I keep him off guard, mix it up as much as I can.
“Unfortunately I was not able to serve it out. To be honest, I feel like I should have found a way to do that, but wasn’t able to.”