Playing his first match of the year after receiving a first round bye, world number two Federer had to come from a set and a break down to overhaul Millman 4-6, 6-4, 6-3 in just over two hours.
Federer was out of sorts throughout the match against a player ranked 151 places below him, making 38 unforced errors — most of them in the opening set-and-a-half.
Millman, on the other hand, played some brilliant tennis, spurred on by the emotion of playing in front of family and friends on his home court.
Two years ago he took a set off Britain's Andy Murray at the Brisbane International before fading away.
Millman was out of the game for 12 months from May 2013 with a shoulder injury and has only played lower level Challenger tournaments since then.
He has won just three matches on the main ATP Tour in his career, two of those in Brisbane, and has US$261,000 in prize money, compared with Federer's $88.6 million.
But for much of the match there appeared little difference between the two as Millman lifted and Federer struggled to find his touch.
Millman, 25, stunned the capacity crowd at Pat Rafter Arena when he broke Federer to take the first set, then broke again to lead 3-1 in the second.
But Federer noticeably lifted a level, breaking straight back before breaking Millman's next serve to force a decider.
The Swiss maestro took advantage of his tiring opponent to ease away with the third set in 37 minutes.
'Just happy to win'
"I was under a lot of pressure — I think I got quite lucky in the second set," Federer said.
"He was playing great tennis until the last couple of games.
"It's the start of the season — I never know what to expect. I was just happy to win."
Federer now plays another Australian wildcard, James Duckworth, in the quarterfinals following his 4-6, 7-6 (7/5), 6-3 win over Finland's Jarkko Nieminen.
Earlier, Canada's Milos Raonic fired off 17 aces in his 6-3, 6-4 win over Mikhail Kukushkin of Kazakhstan.
Raonic ended the year ranked eighth in the world and, along with Grigor Dimitrov and Kei Nishikori, is seen as one of the men most likely to end the dominance of Federer, Novak Djokovic and Rafael Nadal.
He said he had worked on all aspects of his game during the off-season, which stood him in good stead heading into the year's first Grand Slam in Melbourne in just over a week.
"I feel good, I've put a lot of work in technically and on a lot of things, so I feel better as a tennis player — I feel much stronger and fitter," he said.
"I also spent a lot of time sort of discussing and consulting with my team about the mental side, what I need to do to make the next step forward, especially in the big events."
He next takes on fellow big server Sam Groth in the quarter-finals after the Australian won 6-4, 6-7 (2/7), 7-6 (7/3) over Polish qualifier Lukasz Kubot.