Villa, who is set for a three-month spell in Australia with Melbourne City after, became the fourth Spanish player to score in three World Cups when he back-heeled home Juanfran's cross for his 59th international goal in his 97th and final appearance for La Roja nine minutes before half-time.
Andres Iniesta then marked his 100th cap for his country with a lovely through ball for Torres to double Spain's advantage on 69 minutes before Mata slotted home a third eight minutes from time.
Victory means Spain finished third in Group B behind Chile and group winners the Netherlands, whilst Australia slipped to a third consecutive defeat.
The Aussies had started with the energy that had characterised their two encouraging performances against Chile and the Netherlands, but without the suspended Tim Cahill lacked a threat in the final third.
Mathew Leckie pulled a shot well wide for the Socceroos on five minutes, but as the half developed Spain began to take control with Villa particularly prominent.
The former Barcelona and Atletico Madrid striker first went close when his volley from Iniesta's pass at the far post skewed wide.
Australia keeper Maty Ryan then had to beat away Jordi Alba'a driven shot from a narrow angle before Villa very nearly set up the opener with a low cross that the late arriving Koke and Torres just couldn't turn home.
Villa did finally get his goal on 36 minutes with a lovely backheeled finish from Juanfran's low cross to extend his record as Spain's leading scorer of all time.
Koke came close to making it 2-0 before half-time when his long-range shot was tipped behind by Ryan.
Del Bosque surprisingly replaced Villa for Mata just before the hour-mark as the game continued to labour at a slow pace.
Matt McKay sent a dipping volley over the bar as Australia looked in vain for an equaliser that would deliver their first point of the tournament.
However, their hopes were killed off when Iniesta released Torres in behind the Australia defence and he coolly slotted beyond Ryan into the far corner.
Mata rounded off the scoring eight minutes from time when he controlled Cesc Fabregas' lofted pass and rolled the ball through the legs of the helpless Ryan.
And the scoreline could even have been worse for Australia as David Silva fired just wide and Matthew Spiranovic blocked a goalbound effort from Mata in the closing minutes.