INNSBRUCK, Austria — One goal in the closing moments meant more to David Villa than his hat trick earlier in the European Championship.

With a stunning burst in injury time, Villa put Spain into the European Cup quarterfinals Saturday. He outraced two Sweden defenders to a long pass and sent it into the net for a 2-1 victory. It was his fourth goal in two games and put Spain at six points in Group D, three more than Sweden.

Spain won the group when Russia beat Greece 1-0 in a night game.

"I'm prouder of this goal than I was of the three that I scored the other day (against Russia)," Villa said. "It's good for me to be able to be there and bring three points for Spain. Today we suffered a little bit more."

Villa beat defender Petter Hansson to the 40-yard pass from Joan Capdevila. Hansson could not make a play as Villa poked the ball to the left of charging goalkeeper Andreas Isaksson for the victory.

"We're happy. We had many chances in the second half and we managed (to score)," Spain coach Luis Aragones said. "In the second half, we went out looking for the goal and things worked out.

"We were the boss of the ball in the second half. I think definitely think that Spain played better from that point."

Fernando Torres put Spain in front when he lunged at a pass by David Silva with his right foot outstretched and touched it past Isaksson in the 15th minute. Sweden's Zlatan Ibrahimovic tied it in the 34th when Fredrik Stoor curled a pass to Ibrahimovic in the area. The striker turned away from marker Sergio Ramos and hit a low shot that just made it under goalkeeper Iker Casillas.

Ibrahimovic left at halftime because of a swollen knee that assistant coach Roland Andersson said was "not so serious."

"I don't know if we're too dependent on him, but he's a top class player," Sweden coach Lars Lagerback said. "Of course I think we have better chances with Zlatan Ibrahimovic on the field than without."

Torres, rumored to be unhappy with his early substitution in Spain's 4-1 opening win over Russia, touched a diagonal pass into the area intended for Capdevila and Isaksson couldn't stop the deflection.

On his goal, Ibrahimovic initially tried to volley Stoor's cross from the right side. He regained control, swerved and scored with a low right-footed shot that Casillas got a hand on.

"It's of course bitter to lose like this in the final seconds," Lagerback said.

RUSSIA 1, GREECE 0: At Salzburg, Austria, Greece's four-year reign as European champion officially ended.

The Greeks needed at least a draw to stay in contention in Group D, but Konstantin Zyryanov's 33rd-minute goal, combined with Spain's win over Sweden, left the surprise 2004 champions with nothing to play for in their third and final match.

Zyryanov's third international goal in 14 appearances came after Sergei Semak acrobatically sent a pass back across the net, with goalkeeper Antonis Nikopolidis chasing the loose ball.