The Swiss master was rattled by the all-guns-blazing Australian, but finally scraped past him 4-6, 7-6 (7/2), 6-4, 4-6, 7-6 (10/8) to stay alive in his quest for a 21st Grand Slam title.
He will now take on unseeded Hungarian Marton Fucsovics, who eased past American Tommy Paul in straight sets, for a place in the last eight.
"It was tough tonight, thank God it was a super breaker," said the third seed, who looked out for the count when he was down 8-4 in the best-of-10 fifth set super tiebreaker.
"He played a great match -- I can't even speak any more.
"It came down to the wire. I was getting ready to explain myself in the press conference. What a match.
"I had to figure out a way to get him in trouble on his serve," he added. "He was doing such a nice job of not making many mistakes. I never really felt comfortable."
The win handed him not only a 100th victory at Melbourne Park but gave him the distinction of becoming the only player, man or woman, to post a century of victories at two different Slams.
The Swiss great notched three figures at Wimbledon last year.
He is one of only four players in the 100 club -- Martina Navratilova at Wimbledon, and Chris Evert and Serena Williams at the US Open are the others.
But it nearly didn't happen against the 47th ranked Australian Millman, who memorably beat Federer over four gruelling sets in the round of 16 at the US Open in 2018.
One of the fittest players on tour, Millman matched Federer game for game in the opening set until the ninth, when he pounced, converting a second break point when he pounded a forehand winner.
The 38-year-old Federer was struggling to find his rhythm and quickly found himself 5-2 down. He then easily held serve before breaking back with a phenomenal backhand down the line as Millman was serving for the set.
But Federer then blew it, broken to love thanks to poor serving to hand Millman a one-set lead.
Millman was serving well and cracking big forehands and Federer didn't have any answers, with the second set going to serve until a crucial tiebreak when the Swiss stepped up in the pressure-cooker atmosphere, taking his game to another level.
With his confidence restored, he wrestled control of the third set, but Millman refused to give up and came roaring back, excelling in the baselines rallies to break for a 4-3 lead and take the match into a deciding fifth set.
They shared breaks in the tense decider and it went to a tiebreak with Federer looking dead and buried at 8-4 down.
But he stayed calm and somehow hauled himself back to win a Grand Slam classic.