They made it nine wins from nine with a 2-1 victory over Armenia in a rain-drenched Yerevan.
In a clash between a Spanish side who had already secured their spot in next year's finals and an Armenia team whose outside hopes as they made it nine wins from nine with a 2-1 victory over Armenia in a rain-drenched Yerevanof going to South Africa had vanished long ago, it was the European champions who came out on top thanks to Juan Mata's second-half penalty.
Mata coolly slotted home what would prove to be the winning goal from the spot in the 64th minute, just six minutes after Armenia had stunned their visitors by equalising through Robert Arzumanyan.
Spain had earlier taken the lead with a brilliant goal from Cesc Fabregas midway through the first half.
Bosnia-Herzegovina beat Estonia 2-0 in Tallinn to ensure they will finish second in the pool and face a play-off for a World Cup berth.
Edin Dzeko and Vedad Ibisevic were the men on target for Miroslav Blazevic's side.
Emile Mpenza's double earned Belgium a 2-0 victory over Turkey in Brussels.