Successive defeats to open the World Cup meant that the reigning champions entered Monday's affair with elimination already assured.
But La Roja managed to avoid an embarrassing last-place finish by getting a resounding win over the Socceroos.
David Villa started the match and repaid Vicente del Bosque's faith by opening the scoring in the 36th minute. The 32-year-old, who recently signed with New York City FC, got on the end of Juanfran's square pass and flicked a shot behind his own leg and into the back of the net.
Spain continued to dominate the match on the opposite side of halftime, and it was Fernando Torres that doubled the nation's advantage in the 69th minute when he took Andres Iniesta's threaded pass and slipped a shot past Mathew Ryan.
The rout was complete eight minutes from time when Juan Mata took a pass from Cesc Fabregas and fired home his first World Cup goal.
The result sees Spain finish on three points to lock up third place in Group B.
Australia, meanwhile, suffered defeat in each of its three games to slide to the bottom of the group.
2014: The Year in Music [PHOTOS]