David Villa and Fernando Torres saved Spain's blushed by helping them to their first win of the 2014 World Cup, claiming a 3-0 victory over Australia at the Arena da Baixada on Monday evening.
Juan Mata also got on the scoresheet as Spain finished in third place in Group B, while Australia took the fourth and final spot of the four-team pool.
After having both suffered elimination from the tournament with one game still to be played, both teams came into the encounter battling for some sort of pride.
Spain had been particularly disappointing as defending World Cup champions after they fell to a shocking 5-1 defeat to Holland, before crashing to a 2-0 loss to Chile too.
Australia, meanwhile, had suffered the same fates to both teams but had a better goal difference with their 3-1 and 3-2 defeats to Australia and Netherlands respectively.
The first real chance came Spain's way on 17 minutes when David Villa and Santi Cazorla combined well to see the Arsenal man fins space in the box. He hit it on the turn in the Australian penalty area, but his shot was blocked before it could trouble Mathew Ryan.
On 24 minutes Fernando Torres attempted to break the deadlock when he struck a snap shot from the edge of the penalty area that was well blocked by the Australian defence.
Spain eventually took the lead 12 minutes later through Villa. Andres Iniesta played a superb ball through to Juanfran as he cut back to Villa, who then backheeled the ball past Ryan.
The first opportunity after the restart fell to Matt McKay when he got onto the end of a corner kick and struck a volley which flew over Pepe Reina's crossbar with venom.
Fernando Torres made it 2-0 midway through the second 45 when he latched onto Iniesta's through-ball to side-foot the ball into the back of the net for his first World Cup goal since 2006.
The victory was then put beyond a doubt when Juan Mata added the third and final goal eight minutes from time when he controlled the ball and slotted it through Ryan's legs.