Australia's Millman was too hot to handle for the Swissman who struggled to cope with the stifling conditions of the US Open.
"I just though it was very hot tonight and it was just one of those nights where I guess I felt I couldn't get air," Federer said after his shock 3-6 7-5 7-6(7) 7-6(3) defeat to the Australian on Monday night in New York.
Federer was seen wilting in the suffocating humidity, overpowered by a relentless Millman.
It is the first time Federer has lost to a player ranked outside of the top 50 at the US Open and means his aim of reaching a sixth title at Flushing Meadows is now well and truly over.
While Federer suffered in the oppressive conditions at the other end of court 29-year-old Millman, who lives and trains in the heat and humidity of Brisbane, looked perfectly at home.
"John was able to deal with it better," Federer said.
The Swiss second seed, in many eyes the greatest male player of all time, committed a shocking 77 unforced errors and 10 double faults, including two in the final tie-break.
"He maybe comes from one of the most humid places on Earth, from Brisbane, so I knew I was in for a tough one and maybe when you feel like that as well you start missing chances," added the Swissman.
It took Millman three hours and 34 minutes to finish Federer off in four sets and book a place in the quarter-finals against Novak Djokovic.
Federer now exits a Grand Slam before the quarter-finals for just the fifth time since 2004, leaving his fans speechless.
Millman meanwhile is the only unseeded player left in the last eight of the men's draw.