As was expected, the reigning world champions started off the better side but their play ended in many offsides inside the first 15 minutes.
In the fourth minute, Andres Iniesta, the scorer of La Roja's winner at the same venue against Netherlands in the Fifa 2010 World Cup Final, put David Villa through with a neat pass and the latter finding the back of the net but his goal didn't count as he was adjudged to have scored from an offside position.
Bouyed by this start, the Spaniards made Bafana chase the shadows early on.
In the 18th minute, Itumeleng Khune made a great save after dashing off his line to save at Pedro's feet after a great through ball from Xabi Alonso.
Not to be outdone, Gordon Igesund's men took the game to the visitors and a minute after Spain's attack, Bernard Parker and Oupa Manyisa combined resulting in Ace's shot deflecting off a defender onto the crossbar for a corner.
Two minutes later, Parker created some space for himself and unleashed a shot that Iker Casillas saved.
As play approached the half hour mark, Llorente had a free header from a cross by Alvaro Arbeloa, but he couldn't hit the target in the 27th minute with Bongani Khumalo protesting that he had been pushed off the ball.
There were no more real chances until just before the interval when Bafana got a corner. From the resultant set piece, Khumalo's header from Parker's corner was narrowly wide.
The score at the break was goalless.
Both sides made a couple of changes for the start of the second half and Bafana's new man on the park Siphiwe Tshabalala took on the Spanish players in the 47th minute and setting up Rantie with a delightful pass.
However, the striker's shot was way off the target from a tight angle on the right when Parker, on the other side, could have been a better option.
Spain had their first chance of the second half in the 55th minute with Montreal put through one-on-one with Khune, but South Africa's Sports Star of the Year proved his worth with a save.
Bafana broke the deadlock with 56 minutes gone. Rantie, Kamohelo Mokotjo and Parker combined with the latter chipping it over Victor Valdez for Bafana to take a 1-0 lead.
La Roja continued to dominate possession, however, but chances were far and few between for the Europeans with Bafana holding firm.
In fact, Rantie could have put the result beyond doubt with five minutes of regulation time remaining.
Again, Shabba put Rantie through but the Bournemouth striker fluffed the opportunity when Pepe Reina, who had come on for the injured Victor Valdez, made a save.
Spain had two more chances at the death, but it was not to be for the Europeans.
Midfielder Santi Cazorla had his opportunity in the 85th minute, but his shot was not good enough to beat Khune.
Bafana's skipper produced one more save with seconds remaining.
Arbeloa had a chance from close range when he put his right leg to the ball, but Khune was equal to the task.
South Africa: Khune, Ngcongca, Matlaba, Khumalo [Xulu 46th], Nthethe, Furman, Jali [Mokotjo 50th], Manyisa [Zungu 62nd], Claasen [Tshabalala 46th], Parker [Patosi 90th], Rantie.
Spain: Casillas [Valdez 46th] [Reina 80th], Arbeloa, Albiol, Ramos, Monreal, Busquets, Alonso [Mata 62nd], Iniesta [Koke 75th], Pedro [Navas 62nd], Villa [Negredo 58th], Llorente [Cazorla 46th].