Match ends, Costa Rica 1(5), Greece 1(3).
Costa Rica are into the quarter-finals of the World Cup for the first time in their history after beating Greece 5-3 in a penalty shootout in Recife.
Sokratis Papastathopoulos's injury-time equaliser for Greece had cancelled out Bryan Ruiz's side-footed opener and sent the game into extra time.
Costa Rica, down to 10 men for almost an hour after Oscar Duarte's dismissal, scored their first four spot-kicks.
Theofanis Gekas missed for Greece, and Michael Umana settled the tie.
It means the Central American side - surprise qualifiers from a group containing England, Italy and Uruguay - go through to face the Netherlands on Saturday for a place in the semi-finals as their unlikely run at the World Cup continues.
The last-ditch equaliser and the penalty shootout added belated drama to what had been a less than enthralling encounter at times.
Dimitris Salpingidis had the best chance of a turgid first half but his close-range volley from a fine Jose Holebas cross was saved by the legs of Costa Rica's Keylor Navas - the first of several crucial interventions by the Levante keeper.
Christian Bolanos had already sent a half-chance over the bar for Costa Rica while Greece's Giorgos Karagounis saw a long-range effort comfortably saved as erratic passing meant chances were a rarity.
Greece started the second half well with Giorgos Samaras heading a Holebas cross straight at Navas from six yards.
But it was Costa Rica who broke the deadlock with their first shot on target.
Fulham forward Ruiz, who spent the latter part of last season on loan at PSV Eindhoven, converted from the edge of the area, placing a precise side-foot shot into the corner of the goal after a Bolanos pass from the left found him in space.
The Central Americans were incensed not to be given the chance to double their lead after Greek defender Vasilis Torosidis appeared to handle in the box and then lost Duarte when he brought down Holebas to pick up a second yellow card.
Although the game opened up as a result of the dismissal, neither side was able to create a clear opening until the final minute of the game when Papastathopoulos found the net with a scuffed shot from inside the box after Navas had parried Gekas's shot into his path.
The goal, Papastathopoulos's first in international football, sparked wild celebrations on the Greek bench and they might even have won it in what remained of normal time but Navas superbly tipped Kostas Mitroglou's bullet header over the bar.
Greece had further half-chances through Gekas and Kostas Katsouranis before a golden opportunity to win it arrived in the second half of extra time.
They broke upfield from a Costa Rica corner and found themselves with a 5-2 advantage, the ball eventually finding its way to Lazaros Christodoulopoulos - but once again Navas responded agilely to turn the strike away for a corner.
And Costa Rica had their keeper to thank yet again as he saved Mitroglou's late half-volley from six yards in the last seconds of extra time.
There was to be further drama before the penalties had even begun as Greece manager Fernando Santos was sent off.
The first seven spot-kicks were confidently dispatched before Navas made his final and decisive contribution, saving from Gekas and leaving Umana to put Costa Rica through.
- 1NavasBooked at 90mins
- 16GamboaSubstituted forAcostaat 77'minutes
- 6DuarteBooked at 66mins
- 10RuizBooked at 70mins
- 17TejedaBooked at 48minsSubstituted forCuberoat 66'minutes
- 7BolañosSubstituted forBrenesat 83'minutes
- 4ManolasBooked at 72mins
- 2ManiatisSubstituted forKatsouranisat 78'minutes
- 22SamarisBooked at 36minsSubstituted forMitroglouat 58'minutes
- 14SalpingidisSubstituted forGekasat 69'minutes
- Ben Williams
- Shots on Target
Penalty Shootout ends, Costa Rica 1(5), Greece 1(3).
Goal! Costa Rica 1(5), Greece 1(3). Michael Umaña (Costa Rica) converts the penalty with a right footed shot to the top left corner.
Penalty saved! Theofanis Gekas (Greece) fails to capitalise on this great opportunity, right footed shot saved in the bottom left corner.
Goal! Costa Rica 1(4), Greece 1(3). Joel Campbell (Costa Rica) converts the penalty with a left footed shot to the bottom left corner.
Goal! Costa Rica 1(3), Greece 1(3). José Holebas (Greece) converts the penalty with a left footed shot to the bottom right corner.
Goal! Costa Rica 1(3), Greece 1(2). Giancarlo Gonzalez (Costa Rica) converts the penalty with a right footed shot to the centre of the goal.
Goal! Costa Rica 1(2), Greece 1(2). Lazaros Christodoulopoulos (Greece) converts the penalty with a right footed shot to the bottom right corner.
Goal! Costa Rica 1(2), Greece 1(1). Bryan Ruiz (Costa Rica) converts the penalty with a left footed shot to the top right corner.
Goal! Costa Rica 1(1), Greece 1(1). Kostas Mitroglou (Greece) converts the penalty with a left footed shot to the bottom left corner.
Goal! Costa Rica 1(1), Greece 1. Celso Borges (Costa Rica) converts the penalty with a right footed shot to the high centre of the goal.
Penalty Shootout begins Costa Rica 1, Greece 1.
Second Half Extra Time ends, Costa Rica 1, Greece 1.
Foul by Konstantinos Katsouranis (Greece).
Randall Brenes (Costa Rica) wins a free kick in the defensive half.
Corner, Greece. Conceded by Keylor Navas.
Attempt saved. Kostas Mitroglou (Greece) right footed shot from the centre of the box is saved in the centre of the goal. Assisted by Theofanis Gekas with a headed pass.
Corner, Greece. Conceded by Johnny Acosta.
Attempt missed. Kostas Mitroglou (Greece) right footed shot from outside the box is high and wide to the right. Assisted by Kostas Manolas.
Offside, Greece. Kostas Manolas tries a through ball, but José Holebas is caught offside.