A late strike from Raul and a Fernando Torres double saw Spain come from behind to claim a dramatic 3-1 win over Tunisia that clinched a place in the knockout stages of the World Cup.
Tunisia had looked on course for a shock Group H win over the much-fancied Spaniards when midfielder Joahar Mnari steered home at the second attempt after striker Ziad Jaziri had teased his way past three Spain defenders in the eighth minute.
But Spain skipper Raul and fellow substitute Cesc Fabregas turned the course of the match.
Raul pounced on the rebound after Fabregas's low shot from the edge of the area was parried by keeper Ali Bomunijel to level the scores 19 minutes from time.
Five minutes later Fabregas fed a great through ball to the feet of Fernando Torres, who rounded Boumnijel and steered the ball into the empty net.
Torres then grabbed his second goal from the penalty spot, and became top scorer at the tournament with three goals, when he fired home in the first minute of stoppage time.
The striker, who had himself been fouled in the area by substitute Alaeddine Yahia, almost got a hat-trick late on but his drive was brilliantly save by Boumnijel.
Spain had been quick off the mark, with striker David Villa going close after five minutes when he fired a rasping shot into the side netting.
But Mnari stunned them with his early goal and although Spain enjoyed more of the possession they were unable to unlock the Tunisian defence in the first half.
Casillas had to react sharply to stop Jaziri sneaking in for a second while defender Hatem Trabelsi proved to be a real handful with his rampaging runs down the right flank.
Trabelsi and the towering Radhi Jaidi did a great job of shackling Spain's attack, but they were thankful to left back Anis Ayari for clearing a Xabi Alonso header off the line on the stroke of halftime.
Aragones rang the changes at halftime and brought on captain Raul in place of Luis Garcia and Cesc Fabregas instead of Marcos Senna and his substitutes provided the impetus that eventually allowed Spain to break down the Tunisian resistance.