A stunning free-kick from Lazio's Gaizka Mendieta gave Spain a measure of control in this crunch Group B clash.

Raul had taken advantage of a goalkeeping blunder to put Spain ahead, but a fine strike from Benni McCarthy gave the South Africans hope.

With Germany awaiting the second-placed side in Group B and the Republic of Ireland steeling themselves for a Suwon showdown with the winners in the last 16, Spain took a big gamble in making eight changes from the side that beat Paraguay in their last match.

South Africa, needing a point to make history and qualify from the group stages for the first time in their history, had no option but to go for it and fielded all five of their players with one booking.

South Africa could certainly have done without the fourth-minute calamity that gave Spain the lead and Raul his second goal of the tournament.

A fumbled ball in the penalty box allowed Raul to tap the ball into an empty net.

South Africa went level on 31 minutes when McCarthy hooked home inside the six-yard box after Siyabonga Nomvete had headed a cross down.

But seconds before the break, after some spirited play from the Africans, Mendieta won a debatable free-kick on the edge of the box and then stepped up to produce a sublime piece of skill to regain the lead for Spain.