Jozy Altidore scored the opener when he turned his marker Joan Capdevila to fire in from 15 yards.
Fulham's Clint Dempsey doubled the lead in the second half when he converted Landon Donovan's pass from close range.
Tim Howard saved from Fernando Torres and Cesc Fabregas before USA's Michael Bradley saw red for a foul on Xavi.
Many would have predicted Spain to win this match with a lot to spare, judging by the ease with which they won their group games. But Vicente del Bosque's men had only faced New Zealand, Iraq and South Africa in the lead up, and with all respect to those teams, the Americans were always going to be a tougher proposition.
Time and time again in the first half, the USA managed to read Spain's trademark killer passes by sticking tight to potent forwards David Villa and Fernando Torres.
In fact, prior to USA's goal, Spain's best opportunity fell to Liverpool hot-shot Torres whose attempt at a volley from six yards was superbly scuppered by Watford's Jay DeMerit.
What was starkly apparent on the Free State Stadium pitch, was the superior athleticism of the Americans.
On occasions during the opening 45 minutes, they had as many people in their attacking third as they did in their own box.
They went close on a couple of occasions before taking the shock lead, with Charlie Davies sending his bicycle-kick two yards wide before Dempsey missed by the same margin with a low 20 yard drive.
The goal came as a result of a one-two between Carlos Bocanegra and club team-mate Dempsey who found well-built forward Altidore.
The Villarreal striker turned Capdevila far too easily before smacking his drive, which Iker Casillas only managed to get a weak hand to en route, into the back of the net.
Embarrassment was not in Spain's script, so they upped their game and came close to equalising just before the break when Howard was forced to save low with his feet after Torres sold Bocanegra the sweetest of dummies from six yards.
The pressure on the USA defence increased tenfold after the interval with Everton number one Howard forced to make quality saves from Fabregas, twice from long range, and Ramos, who rifled in an angled drive at the near post.
Despite using up masses of energy in defence, the USA made the most of their one and only break forward in the second half.
Donovan found himself free on the right, surged to the edge of the area before playing in a square ball that Ramos, oblivious to who was behind him, could only touch on to Dempsey who fired in from six yards.
Spain surged forward but could not find a way past the solid American defence.
Bradley, who exemplified his side's tenacity, was sent off for a late challenge on Xavi, but by that point the USA had all but cemented their place in the final.
But perhaps most significant was that they prevented Spain from setting a new world record of 36 matches without defeat.
Spain: Casillas, Sergio Ramos, Capdevila, Pique, Puyol, Xavi, Fabregas (Santi Cazorla 68), Alonso, Riera (Mata 78), Torres, Villa.
Subs Not Used: Diego Lopez, Albiol, Arbeloa, Marchena, Pablo, Busquets, Silva, Llorente, Guiza, Reina.
Booked: Capdevila, Pique.
USA: Howard, DeMerit, Spector, Bocanegra, Onyewu, Clark, Dempsey (Bornstein 88), Davies (Feilhaber 69), Donovan, Bradley, Altidore (Casey 84).
Subs Not Used: Guzan, Pearce, Califf, Wynne, Beasley, Kljestan, Adu, Torres, Robles.
Sent Off: Bradley (87).
Booked: Donovan, Altidore.
Goals: Altidore 27, Dempsey 74.
Ref: Jorge Larrionda (Uruguay).