Australian Millman had been given barely a sniff before the match, with excitement already building for a quarter-final clash between Federer and Novak Djokovic at Flushing Meadows.
The 29-year-old, who had never previously beaten a top-10 opponent, appeared to have even less chance of winning with Federer a set and a break up and holding two set points, but he somehow clawed his way back to clinch a 3-6 7-5 7-6 (8/6) 7-6 (7/3) victory.
While Millman, ranked 55, produced the performance of his life, Federer gave one of his poorest displays on the big stage, struggling with all parts of his game and making 76 unforced errors.
The match did not finish until nearly 1am but the temperature was still around 30C with extremely high humidity.
Federer, perhaps looking and sounding his age, said: “I just thought it was very hot tonight. It was just one of those nights where I guess I felt I couldn’t get air. There was no circulation at all. For some reason I just struggled in the conditions. It’s one of the first times it’s happened to me.
“It’s uncomfortable. Clearly you just keep on sweating more and more and more and more as the match goes on. You lose energy as it goes by.
“But John was able to deal with it better. He maybe comes from one of the most humid places on earth, Brisbane. I knew I was in for a tough one. Maybe when you feel like that, as well, you start missing chances, and I had those. That was disappointing.
“But, look, at some point also I was just happy that the match was over, I guess.
“When you feel like that, everything is off. But I’ve trained in tougher conditions. I’ve played in the daytime at 120(F). Some days it’s just not the day where the body can cope with it.
“I do believe since the roof is on that there is no air circulation in the stadium. I think just that makes it a totally different US Open.
“I wish I could have led two sets to love and then maybe the match would be different and I would find a way. It was just tough. I thought John played a great match in difficult conditions.
“I’m happy I’m getting a rest now. Then I come back for the Laver Cup and hopefully finish the year strong.”
Millman is having the best year of his career having struggled with several injuries over the years, most seriously a shoulder problem in 2013. He spent part of the lay-off working for a friend’s finance company and wondering whether his tennis career was over.
Speaking on court, he said: “I’m probably in a bit of disbelief. I have so much respect for Roger and everything he’s done for the game, and he’s been a hero of mine. Today he was definitely not at his best, but I’ll take it.”
Millman joked the only time he expected to be playing on Ashe was a pre-tournament practice session with Andy Murray, but he is determined not to enjoy the achievement too much.
He said: “I’ll obviously remember this for a long, long time. I hope the people who are watching here and back home remember it, too. It’s extremely special. But hopefully I haven’t got a bullet in me yet, I can create a few more moments in my career.”
Earlier, Djokovic also struggled with the heat for the second time this tournament but came through a 6-3 6-4 6-3 victory over Joao Sousa relatively comfortably.
The other quarter-final in the bottom half of the draw will be a rematch of the 2014 final between Marin Cilic and Kei Nishikori.
Nishikori defeated Philipp Kohlschreiber 6-3 6-2 7-5 while Cilic was a 7-6 (8/6) 6-2 6-4 winner against David Goffin.