Costa Rica, who were reduced to 10-man in the second half, were put ahead by Bryan Ruiz in the 52nd minute but a late equaliser by Sokratis Papastathopoulos early in stoppage time rescued Greece as the match headed to extra time. (Agencies)
The two teams, however, could not be separated even in the extra time and finally Costa Rica sealed their maiden quarterfinal berth when Michael Umana converted his team's fifth penalty after Fanis Gekas missed Greece's fourth at Arena Pernambuco.
Celso Borges, Bryan Ruiz, Giancarlo Gonzalez, Joel Campbell and Umana converted all the five penalties for Costa Rica, while Konstantinos Mitroglou, Lazaros Christodoulopoulos and Jose Holebas scored for Greece before Costa Rica goalkeeper Navas made a brilliant save from Theofanis Gekas.
Costa Rica players broke into a dance amid cheering from their fans but the Greece players were left teary-eyed following their exit from the World Cup.
At Fortaleza, Klaas Jan Huntelaar scored an injury-time penalty to send the Netherlands into the quarterfinals with a hard-fought 2-1 win over Mexico.
Arjen Robben was adjudged to have been tripped in the area by Rafa Marquez in the injury time and Huntelaar coolly placed a brilliant penalty into the bottom-left corner to knock Mexico out of the tournament.
However, it was Wesley Sneijder who rescued the 2010 runners-up, in the 88th minute, bringing up the equaliser, cancelling out the 48th minute brilliant goal by Giovani Dos Santos which had put Mexico ahead.
Mexicans had dominated the match and looked destined to reach their first quarter-finals since 1986 but Sneijder's effort two minutes from time and Huntelaar's penalty in added time crushed their dreams.
Costa Rica, who were reduced to 10-man in the second half, were put ahead by Bryan Ruiz in the 52nd minute but a late equaliser by Sokratis Papastathopoulos early in stoppage time rescued Greece as the match headed to extra time.