South Africa were cruelly sent crashing out of the World Cup after Spain secured an enthralling win in Daejeon.
The African team twice came back from behind through Benni McCarthy and Lucas Radebe to restore parity with the Spaniards.
But a 56th-minute goal by the prolific Raul - who also scored Spain's opener following a blunder by keeper Andre Arendse - condemned Bafana Bafana to defeat.
And with Paraguay beating Slovenia 3-1 in the other Group B game, South Africa were denied a place in the second phase.
Spain now face the Republic of Ireland on Sunday, and Paraguay meet Germany on Saturday.
Spain coach Jose Antonio Camacho made wholesale changes to the side that beat Slovenia on Saturday.
He reunited Fernando Morientes with Real Madrid team-mate Raul from the start, and the potent attacking force gelled immediately.
But of greater interest was the return of Gaizka Mendieta, who spent much of last season in the wilderness at Serie A side Lazio.
And it was the midfield playmaker who inadvertently created Spain's opener.
Arendse looked certain to gather Mendieta's seemingly harmless through-ball.
But the South Africa keeper fumbled badly, allowing the oncoming Raul to pinch the ball and duly tap into an empty net.
Despite suffering the early setback, South Africa pushed on in search of the equaliser with great purpose.
The speed with which Sibusiso Zuma and Siyabonga Nomvethe broke caused Spain problems, and the ever-willing Quinton Fortune provided a threat on the left.
It's unfortunate that Paraguay had to beat Slovenia, but
we gave away three silly goals
South Africa coach Jomo Sono
And South Africa were to be rewarded for their endeavour - but not before Arendse redeemed himself with a wonderful save to keep out Fernando Morientes' goalbound header.
A minute later, South Africa restored parity after Nomvethe's head-on found McCarthy and he dispatched with aplomb.
Spain hit back on the stroke of half-time, Mendieta scoring direct from a free-kick which owed as much to his accuracy as to a badly-positioned Arendse.
After the break, Radebe scored his first international goal in 10 years to haul South Africa back into the game, heading past Iker Casillas from a corner.
McCarthy scored South Africa's first equaliser
Yet Bafana Bafana could not hold onto their lead and were undone by the brilliance of Raul on 56 minutes.
The Real Madrid striker rose majestically to head in his second from Joaquin Sanchez's cross.
Spain's second-half substitutes Alberto Luque and Luis Enrique both had chances to extend their side's lead but failed to do so, with Enrique guilty of a particularly bad miss.
And despite South Africa's best efforts late on, Jomo Sono's side could not conjure up the equaliser they needed to make it to the second round.
South Africa: Andre Arendse, Cyril Zama, Aaron Mokoena, Lucas
Radebe (capt), Bradley Carnell, MacBeth Sibaya, Teboho Mokoena,
Quinton Fortune (Jacob Lekgetho 83), Sibusiso Zuma, Siyabonga Nomvethe (George Koumantarakis 74), Benni McCarthy.
Subs Not Used: Delron Buckley, Pierre Issa, George Koumantarakis, Calvin Marlin, Thabo Mngomeni, Bennett Mnguni, Thabang Molefe, MacDonald Mukasi, Hans Vonk, Steven Pienaar, Jabu Pule.
Booked: Nzama, Carnell, Nomvete.
Goals: McCarthy 31, Radebe 53.
Spain: Iker Casillas, Curro Torres, Ivan Helguera, Miguel Angel
Nadal, Enrique Romero, Gaizka Mendieta, Xavi Hernandez, David
Albelda (Sergio 53), Joaquin Sanchez, Raul (capt) (Luis Enrique 82), Fernando Morientes (Alberto Luque 78).
Subs Not Used: Ruben Baraja, Pedro Contreras, Francisco De Pedro, Fernando Hierro, Juanfran, Carles Puyol, Ricardo, Diego Tristan, Juanfran Valeron.
Goals: Raul 4, Mendieta 45, Raul 56.
Referee: Saad Mane (Kuwait)
MATCH STATS |
| S Africa | Spain |
Corners (1st half) | 2 | 3 |
Corners (2nd half) | 1 | 4 |
Fouls committed | 16 | 7 |
Caught offside | 1 | 2 |
Shots on target | 3 | 9 |
Shots off target | 2 | 5 |
Hit woodwork (back into play) | 0 | 0 |
Yellow cards | 3 | 0 |
Red cards | 0 | 0 |
STOPPAGE TIME | |
First half - 1 min | Second half - 3 mins |