Roger Federer suffered a shock defeat at the hands of Grigor Dimitrov in the quarter-finals at the US Open.

The 20-time grand slam winner had looked destined for a box-office final against Rafael Nadal in what would have been the great rivals' first meeting at Flushing Meadows.

But Bulgarian Dimitrov tore up that script with a first ever win over the Swiss, who needed a medical time-out and looked out of sorts throughout a five-set defeat.

Punters on Arthur Ashe for the night session might have feared being short-changed after Serena Williams ran through Wang Qiang in 44 minutes.

After all, Dimitrov had not beaten Federer in any of their previous seven matches, and had taken only two sets off him.

US Open 2019 - best pictures Show all 64 1 /64 US Open 2019 - best pictures US Open 2019 - best pictures Day one A plane comes in over the New York City skyline as seen from the Arthur Ashe Stadium AFP/Getty Images US Open 2019 - best pictures Day one The opening ceremony before the match of Serena Williams of the US against Maria Sharapova from Russia AFP/Getty Images US Open 2019 - best pictures Day One Cameron Norrie of Great Britain returns a shot during his men's singles first round match against Gregoire Barrere of France Getty Images US Open 2019 - best pictures Day one Maria Sharapova of Russia returns the ball to Serena Williams AFP/Getty Images US Open 2019 - best pictures Day one Roger Federer of Switzerland throws balls to members of the public after defeating Sumit Nagal AFP/Getty Images US Open 2019 - best pictures Day two Garbine Muguruza of Spain hits a return against Alison Riske AFP/Getty Images US Open 2019 - best pictures Day two Garbine Muguruza of Spain serves against Alison Riske AFP/Getty Images US Open 2019 - best pictures Day two Dominic Thiem of Austria against Thomas Fabbiano of Italy AFP/Getty Images US Open 2019 - best pictures Day three Novak Djokovic of Serbia receives treatment between games against Juan Ignacio Londero of Argentina AFP/Getty Images US Open 2019 - best pictures Day three Novak Djokovic of Serbia celebrates after defeating Juan Ignacio Londero AFP/Getty Images US Open 2019 - best pictures Day three Serena Williams of the US celebrates her wictory against Caty McNally AFP/Getty Images US Open 2019 - best pictures Day three Serena Williams of the United States reacts during her Women's Singles second round match against Catherine McNally Getty Images US Open 2019 - best pictures Day three Roger Federer of Switzerland celebrates after defeating Damir Dzumhur of Bosnia and Herzegovina AFP/Getty Images US Open 2019 - best pictures Day four Taylor Townsend of the US reacts after winning against Simona Halep AFP/Getty Images US Open 2019 - best pictures Day four Coco Gauff of the US reacts to winning her match against Timea Babos of Hungary AFP/Getty Images US Open 2019 - best pictures Day four Alexander Zverev of Germany celebrates after defeating Frances Tiafoe of the US AFP/Getty Images US Open 2019 - best pictures Day five Serena Williams of the United States reacts during of her Women's Singles round three match against Karolina Muchova of the Czech Republic Getty Images US Open 2019 - best pictures Day six Naomi Osaka of Japan consoles Coco Gauff EPA US Open 2019 - best pictures Day six Naomi Osaka of Japan consoles Coco Gauff USA TODAY Sports US Open 2019 - best pictures Day six Rafael Nadal of Spain serves against Hyeon Chung of Korea USA TODAY Sports US Open 2019 - best pictures Day six Rafael Nadal from Spain serves to Hyeon Chung from Korea AFP/Getty Images US Open 2019 - best pictures Day six Hyeon Chung of South Korea hits a return to Rafael Nadal of Spain EPA US Open 2019 - best pictures Day six Gael Monfils of France celebrates after his match against Denis Shapovalov of Canada USA TODAY Sports US Open 2019 - best pictures Day six Nick Kyrgios of Australia reacts vs Andrey Rublev EPA US Open 2019 - best pictures Day six Andrey Rublev of Russia celebrates winning his Men's Singles third round match against Nick Kyrgios of Australia Getty Images US Open 2019 - best pictures Day seven Novak Djokovic retired from his US Open clash with Stanislas Wawrinka due to a left shoulder injury AFP/Getty US Open 2019 - best pictures Day seven Serena Williams of the United States celebrates after winning her Women's Singles fourth round match against Petra Martic of Croatia Getty Images US Open 2019 - best pictures Day seven Roger Federer made light work of David Goffin Reuters US Open 2019 - best pictures Day seven Johanna Konta celebrates beating Karolina Pliskova on her way to the quarter-finals Getty Images US Open 2019 - best pictures Day seven Qiang Wang of China celebrates winning her Women's Singles fourth round match against Ashleigh Barty of Australia Getty Images US Open 2019 - best pictures Day eight Osaka struggled against Bencic AFP/Getty US Open 2019 - best pictures Day eight Osaka waves goodbye to the US Open fans USA Today US Open 2019 - best pictures Day eight Rafael Nadal saw off Marin Cilic to reach the US Open last eight AFP/Getty US Open 2019 - best pictures Day eight Marin Cilic lost to Nadal in four sets after putting up a good fight AP US Open 2019 - best pictures Day eight Alexander Zverev of Germany reacts as he plays against Diego Schwartzman of Argentina AFP/Getty Images US Open 2019 - best pictures Day eight Alexander Zverev receives a code violation during his defeat by Diego Schwartzman Getty Images US Open 2019 - best pictures Day nine Roger Federer of Switzerland hits a backhand against Grigor Dmitrov USA TODAY Sports US Open 2019 - best pictures Day nine Grigor Dimitrov of Bulgaria falls as he plays Roger Federer of Switzerland EPA US Open 2019 - best pictures Day nine Grigor Dimitrov of Bulgaria wins the quarterfinal match against Roger Federer of Switzerland USA TODAY Sports US Open 2019 - best pictures Day nine Roger Federer of Switzerland reacts as he leaves the court after losing to Grigor Dimitrov of Bulgaria EPA US Open 2019 - best pictures Day nine Daniil Medvedev of Russia hits a return to Stan Wawrinka of Switzerland EPA US Open 2019 - best pictures Day nine Daniil Medvedev of Russia (L) hugs Stan Wawrinka of Switzerland after defeating him in their Men's Singles Quarterfinal match AFP/Getty Images US Open 2019 - best pictures Day nine Daniil Medvedev of Russia is interviewed on court after beating Stan Wawrinka USA TODAY Sports US Open 2019 - best pictures Day nine The sun sets behind the Manhattan skyline as Serena Williams of the United States faces Qiang Wang of China in a quarterfinal match USA TODAY Sports US Open 2019 - best pictures Day nine Serena Williams of the US reacts after defeating Qiang Wang of China during their quarter-finals round match EPA US Open 2019 - best pictures Day nine Serena Williams, of the United States, returns a shot to Qiang Wang, of China, during the quarterfinals AP US Open 2019 - best pictures Day 10 Rafael Nadal celebrates his victory over Diego Schwartzman in the US Open quarter-finals AFP/Getty US Open 2019 - best pictures Day 10 Matteo Berrettini celebrates after beating Gael Monfil to reach the semi-finals Reuters US Open 2019 - best pictures Day 10 Bianca Andreescu is through to the semi-finals of a Grand Slam for the first time Getty US Open 2019 - best pictures Day 10 Belinda Bencic reached the last four of the US Open Getty US Open 2019 - best pictures Day 11 Serena Williams came past Elina Svitolina to reach yet another US Open final Getty Images US Open 2019 - best pictures Day 11 Bianca Andreescu beats Belinda Bencic in the semi-finals Getty Images US Open 2019 - best pictures Day 12 Rafael Nadal reaches the final where he will play Daniil Medvedev Getty Images US Open 2019 - best pictures Day 13 Bianca Andreescu arrives on court listening to music before the final Getty US Open 2019 - best pictures Day 13 Bianca Andreescu reacts as she wins against Serena Williams of the during the women's singles final – her first grand slam title AFP/Getty Images US Open 2019 - best pictures Day 13 Bianca Andreescu of Canada reacts as she wins against Serena Williams of the US during the Women's Singles Finals match AFP/Getty Images US Open 2019 - best pictures Day 13 Bianca Andreescu poses with the trophy after she won against Serena Williams AFP/Getty Images US Open 2019 - best pictures Day 14 Bianca Andreescu of Canada poses with her trophy at the Top of the Rock in Rockefeller Center Getty Images US Open 2019 - best pictures Day 14 Daniil Medvedev of Russia wipes his face while playing Rafael Nadal AFP/Getty Images US Open 2019 - best pictures Day 14 Rafael Nadal, of Spain, reacts after defeating Daniil Medvedev, of Russia, to win the men's singles final of the U.S. Open AP US Open 2019 - best pictures Day 14 Rafael Nadal of Spain reacts after defeating Daniil Medvedev of Russia during the men's final match EPA US Open 2019 - best pictures Day 14 Rafael Nadal of Spain reacts during the men's Singles Finals match against Daniil Medvedev AFP/Getty Images US Open 2019 - best pictures Day 14 Rafael Nadal of Spain (L) celebrates his victory over Daniil Medvedev of Russia (R) AFP/Getty Images US Open 2019 - best pictures Day 14 Rafael Nadal of Spain holds the trophy after his win over Daniil Medvedev AFP/Getty Images

The majority of those defeats came when the Bulgarian was a constant in the top 10, peaking as high as world number three. And coming into New York he had slumped to a lowly 78.

But all was clearly not well with Federer, who hit an unprecedented 60 unforced errors.

He had been flexing his racket arm during the fourth set, and in a rare occurrence the 38-year-old took a lengthy break from court for treatment before the start of the decider. Dimitrov filled the time doing press-ups.

Two breaks of the Federer serve later, Dimitrov was 4-0 up and in unchartered territory.

A Federer hold to 15 momentarily stopped the bleeding, until Dimitrov responded in kind.

Federer made Dimitrov serve out the match, and the 28-year-old did so to love to seal the biggest win of his career, 3-6, 6-4, 3-6, 6-4, 6-2.

"It's been a while since I've been on this court so I was nervous in the first set and he served really well," said Dimitrov.

"I think after the second set I felt I was getting a good stride on my shots.

"We had a really long game in the fourth set and I wanted to make him stay on court for long as possible.

"For sure he was not at his best at the end. It's the best of five and anything can happen."

Roger Federer was knocked out of the US Open quarter-finals (AFP/Getty)

With Novak Djokovic out Federer knew he had possibly the best chance he will get to win major title number 21.

Little wonder, then, that he cut a disconsolate figure afterwards, admitting his back was playing up.

"I just feel low," he said. "Just disappointed it's over because I did feel like I was actually playing really well after a couple of rocky starts.

"It's just a missed opportunity to some extent that you're in the lead, you can get through, you have two days off after. It was looking good."

In the last four Dimitrov will face Daniil Medvedev, who continued to wind up the US Open crowd after knocking out Stanislas Wawrinka to reach his first grand slam semi.

The Russian fifth seed remains public enemy number one among the Flushing Meadows fans after flipping them a 'visual obscenity' during his win over Feliciano Lopez last week.

Medvedev needed extensive treatment to his thigh during the first set, which he eventually took on a tie-break.

Grigor Dimitrov celebrates the biggest win of his tennis career (Reuters)

Wawrinka, the 2016 champion, must have felt he might have another retirement on his hands, having seen previous opponent Novak Djokovic throw in the towel two nights earlier.

But despite the crowd once again cheering Wawrinka's every point to the rafters, it was Medvedev who ran out the 7-6 (6) 6-3 3-6 6-1 winner.

The 23-year-old's goading of the crowd in his on-court interviews has been a feature of this tournament, and he concluded his latest one by saying: "So many people support me, so many people don't like me.

"I can just say, I try to be myself guys. I have to say, sorry guys, and thank you!"

Medvedev earlier explained his injury issues, revealing he felt he may not be able to finish the match.

He said: "The match was really strange. I had really big pain in my quadriceps and I didn't feel I could continue in the first set.

"I feel really strange about this match but I'm happy to be in my first major semi-final.

"Before the match I was feeling perfect, and all these tapes were for protection.

"In the first game of the match I pulled my quadriceps. I took a painkiller and by the fourth set I was feeling normal.

"I'll see how I feel in the morning and try my best to be fit for the semis."