The Argentine, who won his only grand slam title in the city in 2009 by beating Federer in the final, triumphed 7-5, 3-6, 7-6, 6-4
US Open: Del Potro stuns Federer to set up semi-final against Nadal, all-Americans line up in last four of women's draw
Juan Martin del Potro sensationally gatecrashed the US Open again on Wednesday, stunning five-champion Roger Federer and shattering hopes of a first New York showdown between the Swiss legend and Rafael Nadal.
The Argentine, who won his only grand slam title in the city in 2009 by beating Federer in the final after seeing off Nadal in the semis, triumphed 7-5, 3-6, 7-6, 6-4 in front of a spellbound Arthur Ashe Stadium crowd.
Del Potro, 28, will once again face world No 1 Nadal in the semi-finals on Friday, a stunning achievement for a man who had saved two match points to beat sixth seed Dominic Thiem in the last 16.
Nadal, who will keep his world No 1 status following third seed Federer's exit, had earlier defeated Russian teenager Andrey Rublev 6-1, 6-2, 6-2 in just 97 minutes.
It will be a sixth US Open semi-final for Nadal and 26th at the majors while Del Potro, the 24th seed, will be playing in just his fourth last-four match at the slams.
For Federer, 36, it was a first grand slam loss of 2017 after he had captured the Australian Open and Wimbledon titles to take his career tally to 19.
"I served really good. I hit my forehand as hard as I could and I played a great match. I deserved to win," said Del Potro who will be in his first major semi-final since Wimbledon in 2013.
"This feels like my home court. I played Rafa here in 2009 too. Hopefully I can get the same result on Friday."
Del Potro, whose career was almost ended last year after undergoing four wrist surgeries, wrapped up the first set thanks to a break in the 11th game secured with a blistering crosscourt pass.
Federer, who had a 16-5 winning record over Del Potro ahead of the quarter-final, levelled the tie after breaking for a 3-1 lead in the second.
However, the match turned in the third set tiebreak when Del Potro saved four set points before a weary and error-riddled Federer dropped serve again to trail 3-2 in the fourth.
Victory was Del Potro's eight minutes short of three hours with a deep forehand as Federer was left to survey the wreckage of 41 unforced errors.
"It's hard to explain, I didn't play that badly," Federer said. "I just ran into a guy who was better on the bigger points. I don't deserve to still be in the tournament."
Nadal will take an 8-5 record over Del Potro into the semi-final where the winner will face either Kevin Anderson or Pablo Carreno Busta for the title.
"Juan Martin is a top player. When he's playing well, it's difficult to stop him. Probably the forehand is maybe the fastest on the tour," said Nadal, who is chasing his second major of the year to add to his French Open.
Rublev, bidding to be the youngest man in 17 years to reach the semi-finals, had no complaints over his loss to Nadal.
"He gave me a lesson: 1, 2, and 2," said the Russian, who lost 16 of the last 19 points of the opening set and finished with 43 unforced errors.
The women's semi-finals will be an all-American affair after CoCo Vandeweghe and Madison Keys set-up a last-four duel.
Thursday's other tie will see seven-time major champion Venus Williams face Sloane Stephens.
American 20th seed Vandeweghe claimed a 7-6, 6-3 win over the Czech Republic's Karolina Pliskova, whose brief eight-week stay as world No 1 ended with Wimbledon champion Garbine Muguruza taking over.
Vandeweghe's victory means that the US Open will have an all-American semi-final line-up for the first time since 1981 after Keys defeated Estonian qualifier Kaia Kanepi 6-3, 6-3.
"I won the juniors here when I was 16 and dreamed of playing on the real stage," said Vandeweghe, 25, who also made the semi-finals at the Australian Open, beating then-world No 1 Angelique Kerber in the process.
The last time four US women were in the semis was 36 years ago when eventual champion Tracy Austin, Chris Evert, Martina Navratilova and Barbara Potter all made it.
Keys, the 15th seed, will be playing in her second slam semi-final after the 2015 Australian Open.
"It means the world to me," said Keys, who underwent wrist surgery earlier this season.