Miami Masters - Del Potro topples Nadal in Miami
Big-serving Del Potro, who came back from 3-0 down in the third set, will face Britain's Andy Murray for a place in the final.
The tall Argentine takes his place in the last four of a Masters event for the first time with the crowd-pleasing victory. It was also his first win over Nadal at the fifth attempt.
"Maybe it was wonderful for the crowd but it was terrible for me," said Nadal.
"I think I played really bad all the time. That's the truth of this match. Later when I was 3-0 up in the third I played worse.
"I had the match; it was an amazing disaster."
In an atmosphere more akin to a football match, Del Potro, who lost to Nadal in Indian Wells last month, was roared on by hundreds of Argentinian fans who sensed an upset from the moment their man broke in the first set to go 5-4 up.
Having served out to win the opening set, Del Potro broke early in the second but the 20-year-old from Tandil then faced the inevitable fightback from the Spaniard, who played some powerful strokes around the court to win the second.
Nadal looked on course for victory when he broke twice early in the third to go 3-0 up but with the fans chanting his name, Del Potro, looking wild in his sleeveless shirt and headband, found the strength to mount a revival of his own.
The Argentine broke back twice to go to 3-3, levelling the set with a brilliant cross-court drive.
Both players then stuck largely to the baseline, but at 6-5 to Del Potro, Nadal had to serve to save the match and found himself 40-15 down after going to the net and putting the ball out wide to the right.
Nadal saved three match points, with an ace bringing him back to deuce, and when Del Potro hit the net and then drove long the set was tied at 6-6.
Luck seemed to be with Nadal when at 2-2 in the tie-break his shot hit the top of the net and dropped down for a point, but once again Del Potro, celebrating every point with a fist pump, found another burst of determination and took the next five points to win.