Spain made it three wins out of three at Euro 2008 as Greece bowed out of the tournament with defeat in Salzburg.
Defending champions Greece took the lead when Angelos Charisteas headed home a Giorgios Karagounis free-kick.
Spain levelled when Ruben De la Red thundered a shot in off the underside of the crossbar.
And the Spanish kept up their 100% record when Daniel Guiza headed in a late winner from a Sergio Garcia cross to continue Greece's misery.
Greece had looked like they might salvage some pride from a disappointing defence of their trophy, but Guiza's goal in the 88th minute means they go home pointless.
Euro 2008 quarter-final line-up
Thursday - Germany v Portugal
Friday - Croatia v Turkey
Saturday - Netherlands v Russia
Sunday - Spain v Italy
Meanwhile Spain will head into their quarter-final against Italy with high hopes of succeeding the Greeks as champions of Europe.
Spanish coach Luis Aragones was even able to give his first-team some extra rest ahead of their meeting with the world champions by leaving out 10 players.
The multiple changes ensured a fairly low-key game at the Stadion Wals-Siezenheim.
Until Greece's goal shortly before half-time, the most notable incident was the combustible Karagounis creating history by becoming the first player to receive six yellow cards at European Championships.
It was the Panathinaikos midfielder's inswinging free-kick that picked out Charisteas on the penalty spot and the big forward produced a wonderful header to beat Pepe Reina on 42 minutes.
But the other side of Karagounis emerged just before half-time when Spain's Andres Iniesta took a tumble in the box.
The Spanish players were furious with English referee Howard Webb for refusing to award them a penalty.
And although the decision looked correct, Karagounis took the brunt when he fell to the ground and had the ball drilled at his head from point-blank range.
The midfielder had to be calmed down by Webb, who was suddenly having a far sterner test than he could have imagined in what was effectively a dead rubber of a game.
Liverpool midfielder Xabi Alonso was one of the few Spanish players to make a strong case for selection in the knockout stages.
Guiza ensured a miserable ending for the Greeks
He almost caught out Antonis Nikopolidis with a shot from inside his half that just landed the wrong side of the post and led to Greece's keeper, who was playing his last game for his country, colliding with the woodwork.
The upright denied an Alonso blockbuster of a shot from 35 yards in the second half as Spain raised their tempo.
They got back on level terms when De la Red pounced on a Guiza knockdown and drilled in a shot that neither Nikopolidis nor the crossbar could keep out.
Charisteas hit the outside of the post for Greece, but Spain looked the much more likely side to go on and win it.
Guiza and Garcia both shot just wide before the pair combined for Guiza to head his first international goal from close range in the dying stages.
Spain extend their unbeaten run to 19 games and will hope to make that 22 before this tournament is over.
Greece: Nikopolidis, Vyntra, Kyrgiakos (Antzas 63), Dellas, Spyropoulos, Basinas, Karagounis (Tziolis 74), Katsouranis, Salpigidis (Giannakopoulos 86), Charisteas, Amanatidis. Subs Not Used: Chalkias, Tzorvas, Samaras, Goumas, Liberopoulos.
Booked: Karagounis, Basinas, Vyntra.
Goals: Charisteas 42.
Spain: Reina, Arbeloa, Albiol, Juanito, Fernando Navarro, Sergio Garcia, De la Red, Alonso, Iniesta (Santi Cazorla 59), Fabregas, Guiza. Subs Not Used: Casillas, Palop, Capdevila, Marchena, Puyol, Villa, Xavi, Torres, Sergio Ramos, Senna, Silva.
Booked: Guiza, Arbeloa.
Goals: De la Red 61, Guiza 88.
Ref: Howard Webb (England).