However despite not finishing until almost 1am, the temperature was still around 30C with extremely high humidity.

And Federer, 37, thinks the conditions took their tool.

"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.

GETTY

Roger Federer: The heat of New York appears to have played a part in his defeat

"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've played in the daytime at 120(F). Some days it's just not the day where the body can cope with it”

Roger Federer explains his shock US Open defeat

"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.

EPA

Roger Federer: The Swiss superstar will rest up before returning to action

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."

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.