Liverpool's Torres fired Spain ahead in the 15th minute but Zlatan Ibrahimovic levelled things up in the 34th minute with a goal that looked to have earned Sweden a share of the points.

However, Villa ran on to a long ball in injury time to tuck beyond Sweden goalkeeper Andreas Isaksson.

Spain are now through to the next round and will be joined by either Sweden or Russia.

miss out

Konstantin Zyryanov gave Russia a 1-0 win over Greece and eliminated the holders from Euro 2008.

Veteran Greek goalkeeper Antonis Nikopolidis rushed out of his goal and along the byline to retrieve a deep cross only to miss out and allow Sergei Semak to hook the ball back into the box for Zyryanov (34) to tap home.

Sweden will now face Russia in the final match for a place in the knock-out round.