Federer will now play Andy Murray’s conqueror Mischa Zverev after winning 6-7 (4/7), 6-4, 6-1, 4-6, 6-3 in three hours 24 minutes on Rod Laver Arena.
The Swiss legend lost the opening set in a tiebreaker after being a double service break down. He sailed through the next two sets before Nishikori fought back to take the match into a fifth.
Nishikori, who had lost his last three matches against Federer, was troubled by a left hip injury and twice needed courtside treatment from a trainer.
It was another rousing victory for the 35-year-old Federer, who demolished long-time rival Tomas Berdych in straight sets before beating world number five Nishikori in five sets.
“Kei’s a tough customer. This is a huge win for me in my career,” Federer said.
“Kei will give you some looks, he’s not the biggest server on tour but one of the greatest on the baseline.”
Federer holds a career 2-0 record over Zverev, who pulled off a massive upset over world number one Andy Murray earlier on Sunday.
“I would never have picked it, I like Mischa a lot and he has a nice game coming forward. It will be different,” Federer said.
Federer clawed back from a double break to take the opening set to a tiebreaker only to lose it seven points to four.
The Swiss maestro skated through the second and third sets for the loss of five games and appeared set to round it off in four sets.
But Nishikori fought back hard and held a titanic, 10-minute service game in the fourth game before breaking Federer’s serve in the next game.
He took the match to five sets, but he was troubled by the existing hip injury and sought the trainer for treatment at two changeovers.
Federer broke in the second game of the final set and held the advantage through to the end to improve his career five-set record to 25-20.
The Swiss legend is looking to become the third man to win five Australian Open singles titles after Novak Djokovic and Roy Emerson, who have both won six.
It is the 13th time Federer has reached the last eight, extending his record for most Australian Open quarter-finals..