Substitute Juan Mata rolled a third goal between the legs of goalkeeper Mat Ryan in the 82nd minute as Australia ran out of steam.

Spain had nothing but pride to play for after losing their first two games. Australia were also on their way home after defeats to Chile and the Netherlands.

Coach Vicente del Bosque made seven changes from the Spanish team that started with a 2-0 defeat by Chile.

Midfielder Andres Iniesta kept his place and won his 100th cap.

Iniesta, scorer of the winner in the 2010 final, showed his craft by helping to create Villa's goal with a superb pass that sent defender Juanfran clear in space on the right wing.

Villa, Spain's record goal-scorer, claimed his 59th goal in 97 games for his country when he turned in the cross. It was probably his last appearance for Spain as he prepares to play in MLS soccer next year.

Australia almost hit back immediately, goalkeeper Pepe Reina hacking the ball clear in a goalmouth scramble.

That was a rare threat from an inexperienced Australian team who missed the presence of suspended leading scorer Tim Cahill up front.