Spain claimed third place at the FIFA Confederations Cup 2009 with a dramatic 3-2 extra-time victory over host nation South Africa at the Royal Bafokeng Stadium in Rustenburg.

Bafana Bafana had come within minutes of winning the game thanks to Katlego Mphela's 73rd-minute opener, only for fellow substitute Daniel Guiza to find the net in both the 88th and 89th minute to leave the home fans shell-shocked. But up stepped Mphela again to thump home a free-kick from fully 35 yards in the third minute of added time and take the match into extra-time, when another set-piece from Xabi Alonso eluded everyone including home keeper Itumeleng Khune and finished in the back of the net.

South Africa fought hard to the end of a pulsating encounter, and exit the tournament knowing that a firm foundation has been laid for next year's FIFA World Cup™ finals. They had opened their account when Mphela took full advantage of an excellent cross from Siphiwe Tshabalala from the left, recovering well from a poor first touch to fire high into the roof of Iker Casillas' net. But with beanpole striker Fernando Llorente on as a substitute and giving Spain a focal point for their attacks, it freed up fellow sub Guiza to do what he does best: score goals.

The first came from Santi Cazorla's ball into the centre of the penalty area, which Guiza did well to control before snapping off a low, hard shot past Khune and into the bottom corner. With the South Africans still in shock, Guiza received possession on the right-hand side of the area and looked to have been crowded out, before managing to make the space for a crafty lob with very little back-lift which flew over Khune and in off the inside of the far post.

There was still time for another twist, however, with Mphela's brilliant 93rd-minute free-kick reigniting South Africa's hopes and forcing an extra 30 minutes. Twice in the first half of extra-time Iker Casillas was called into action, first by Mphela who broke past the La Roja backline but was denied by the legs of the keeper, and then by Bernard Parker whose drilled shot from the edge of the box was tipped away expertly. The home side appeared to lose a little impetus from that point and paid dearly in the 107th-minute when a careless foul from Matthew Booth on Llorente gave Xabi Alonso the chance to curl in the winning goal.

For Spain, they will be able to take some consolation from on a spirited finish to a tournament many people had expected them to win. And despite their defeat, South Africa will have arguably taken much more from this competition. As well as successfully increasing public faith in coach Joel Santana, the emergence of cult heroes such as Booth, Parker, Mphela, Khune and Teko Modise, as well as gifted right-back Siboniso Gaxa and industrious midfielder Steven Pienaar, will no doubt work wonders for morale in the build up to next year's finals.