(CNN)Five-time champion Roger Federer crashed out of the 2018 US Open in a stunning fourth-round loss to Australian John Millman.
The Swiss, who last won the tournament in 2008, went down 3-6 7-5 7-6 (9-7) 7-6 (7-3) to the world No. 55 in three hours and 34 minutes.
The out-of-sorts Federer failed to convert set points in the second and third sets before faltering again in the fourth.
Two Federer double faults put his opponent 4-1 up in the tie-break and an overcooked Federer forehand secured a memorable win for the 29-year-old Millman, who will next play Wimbledon champion Novak Djokovic in the quarterfinals.
It is the first time Federer, who has only failed to reach the quarterfinals of a grand slam on seven occasions, has lost to a player ranked outside the top 50 at the US Open.
"It was very hot, one of those nights where I felt I couldn't get air," Federer, who made 77 unforced errors in the match, told reporters.
"There was no circulation at all. For some reason, I struggled in the conditions. It's one of the first times it's happened to me. I do believe since the roof is on that there is no air circulation in the stadium. That makes it a totally different US Open.
"But John was able to deal with it better. He comes from maybe one of the most humid places on earth, Brisbane. I knew I was in for a tough one. I was just happy that the match was over."
Until Monday night, Federer had been 40-0 against opponents outside the top 50 at the US Open.
Leading up to this match, the 37-year-old had displayed his usual dominance, swatting aside Japan's Yoshihito Nishioka, France's Benoit Paire and Millman's compatriot, the 30th seeded Nick Kyrgios, in straight sets.
But an anticipated quarterfinal tie against old rival Djokovic, which would have been their 47th meeting and seventh at the US Open, was scuppered by Millman, who will now meet the Serb Thursday.
"I have so much respect for Roger and what he has done for the game," said Millman during a courtside interview.
"He definitely was not at his best, but I'll take it. I felt like a deer in the headlights at the beginning, to be honest with you. Roger had the ball on a string, but I got a bit more aggressive and probably capitalized a bit on Roger having an off-service day.
"The one thing I can control is the fight in me. It's the one thing I've always done throughout my career."
Sharapova also suffers fourth-round loss
Another major name made an early exit at Flushing Meadows Monday as former champion Maria Sharapova lost 6-4 6-3 to Spain's Carla Suarez Navarro in the fourth round.
Sharapova, 31, has only once reached the quarterfinal of a grand slam since she returned from a 15-month doping ban in April 2017 and last reached the last eight in New York in 2012.
The 2006 US Open champion told reporters: "If I didn't have the belief to keep doing this and to keep having the motivation and the grind of doing this every day in order to get myself in these positions, I don't think I would be here."
Asked whether this was the most challenging period of her career, Sharapova -- who left Russia for the US with her father aged seven -- said: "What's challenging is when you're a teenager and you have a few hundred dollars and you've got no sense of the future and you don't know where you're going to end up.
"You just have a dream. I think that's a lot tougher than being 31 years old and having the opportunity to do whatever I want in my life."
Navarro, the world No.24 who was celebrating her 30th birthday Monday, will play home favorite Madison Keys in the quarterfinals.