Georgios Samaras' last-gasp penalty saw Greece beat Ivory Coast 2-1 and reach the FIFA World Cup's last 16 for the first time.
Needing a win to qualify in Fortaleza on Tuesday, Greece left it late, with Samaras' 93rd-minute spot-kick sealing their progression from Group C in dramatic circumstances.
The penalty was given after the forward was tripped by Giovanni Sio and the Celtic man dusted himself down before scoring to Boubacar Barry's left.
A draw would have been enough for Ivory Coast to progress and that looked likely when Wilfried Bony came off the bench to level proceedings with 16 minutes left.
Greece had initially taken the lead through Andreas Samaris – an early replacement for the injured Panagiotis Kone – in the 42nd minute.
They had also hit the bar earlier, through Jose Holebas, and the woodwork was to deny them again in the second half as Giorgos Karagounis saw his 35-yard strike bounce away to safety.
But Greece claimed a deserved win as Samaras kept his nerve, setting up a clash with Costa Rica in the round of 16.
Yaya and Kolo Toure both started, after deciding to stay in Brazil following the death of their brother, while captain Didier Drogba made his first start of the tournament, replacing Bony.
Greece's start was thrown into disarray by two forced substitutions inside the first 30 minutes, as Kone and goalkeeper Orestis Karnezis suffered injuries.
But they almost took the lead in the 33rd minute from a quick break, as Holebas – played in following Samaras' well-weighted through-ball – saw his fierce strike come back off the crossbar.
The goal frame did not come to the rescue of Barry nine minutes later, though.
A stray pass from Cheick Tiote saw Samaris pounce, and he combined well with Samaras before coolly slotting past the goalkeeper.
Ivory Coast continued to control possession, but failed to convert it into regular chances, as their opponents looked more decisive in attack.
Greece's threat on the counter only grew as the second half progressed and Ivory Coast were rescued by the bar for a second time with 22 minutes to go, when captain Karagounis tried his luck from 35 yards.
The introduction of Bony gave Ivory Coast another dimension and after wasting a pair of half-chances, the Swansea City forward drew his side level, producing a composed first-time finish after Gervinho's clever cut-back.
But it was the Greeks who looked more likely to score the winner, as Dimitrios Salpingidis flashed an effort wide, before Sio's foul gave Samaras the chance to be a hero.
And it was an opportunity he took with both hands, slotting past Barry to earn Fernando Santos' side a place in the next round.
|Coach: Fernando Santos|
for P. Kone 12'
for O. Karnezis 24'
for G. Karagounis 78'
|Benteke a ´bargain´ buy - Rodgers|
|Zola: Qatar would be ideal for Balotelli, Cassano|
|Suarez: I´m not among world´s best|
|PSG ready despite ´chaotic´ pre-season - Blanc|
|Arsenal thumping still hurts - Fournier|
|Aubameyang targets Champions League success|
|Rooney set for Everton return|
|Cech can match Van der Sar - Wenger|
|Mourinho ponders Wenger´s losing record against him|
|CBF confirm Fred failed a doping test|
|Bournemouth beaten by battling Cardiff|
|Immobile injury overshadows Sevilla win at Vicarage Road|
|Lambert at the double on West Brom bow|
|Real sign up Spain starlet Vallejo|
|Valencia blow for West Ham|
|Elche cleared to play in Segunda Division|
|Baker pens a new Villa deal|
|Lambert makes Albion switch|
|Gillingham and Scally found guilty of ´race victimisation´|
|Inter complete Jovetic signing|
|Arsenal v Chelsea: Mourinho cools Wenger rivalry ahead of Wembley meeting|
|Villa snap up Gestede|
|Villa land Veretout|
|Mourinho coy on fresh Stones bid|
|Aubameyang commits to Dortmund|
|Torres on the hunt for trophies with Atletico|
|Cazorla and Walcott sign new Arsenal deals|
|Quick start vital in Arsenal title bid - Wilshere|
|I have received no offers - Guardiola|
|Barcelona to monitor Turan injury|
|Zorc ´surprised´ by Grosskreutz-Tuchel row|
|Phil Neville could be England manager - Moyes|
|UEFA to investigate Shakhtar´s Fred selection|
|City loan Unal to Genk|
|China v South Korea: Stielike looking for new options|
|North Korea v Japan: Halilhodzic to unearth new faces|
|Drogba: I want to be ready, not a burden|
|Hamstrung Clasie in doubt for Southampton league opener|
|West Ham goalscorer Zarate bemoans Astra comeback|
|Negredo quashes Valencia exit rumours|
|´This is not my Sampdoria´ - president Ferrero|
|Criscito could join Inter - agent|
|CBF endorse Zico´s FIFA presidency campaign|
|Hawit to handle CONCACAF´s referee review|
|Falcao is a ´top, top player´ - Terry|
|Tuchel pleased by Dortmund fighting qualities|
|Premier League rules out schedule changes for Champions League clubs|
|UEFA Europa League Review: Southampton stroll as Sampdoria are humiliated|
|Koeman confident of Southampton progress|
|Bilic frustrated with Collins´ red card, Valencia injury|
|Bamford hits hat-trick in Bromley friendly|
|Southampton 3 Vitesse 0: Play-offs in sight for Koeman’s men|
|Wolfsberger 0 Borussia Dortmund 1: Tuchel begins tenure with narrow win|
|West Ham 2 Astra 2: Collins red allows visitors back in|
|Kukesi - Legia match abandoned|
|Joining Roma an ´easy decision´ - Szczesny|
|Chiriches joins Napoli from Spurs|
|Mihajlovic pleased with Milan improvements|
|Injured Chiellini to miss Supercoppa|
|Newcastle complete Mbemba swoop|
|Blackpool protest incurs FA fine|
|Scottish Premiership Preview: Dons seek to run Celtic closer|
|Paris Saint-Germain v Lyon: Ibrahimovic ready for season opener|
|Wolfsburg v Bayern Munich: De Bruyne centre of attention|
|Real Madrid 0 Milan 0 (10-9 on pens): Real lift second International Champions Cup|
|De Bruyne a doubt for Supercup clash|
|Reine-Adelaide needs time to blossom, says Walcott|
|Rodgers will not rush Ibe development|
|Napoli not interested in selling Higuain - De Laurentiis|
|Wilson agrees Bournemouth extension|
|Messi makes early Barcelona return|
|Ibrahimovic: My next move will be a very big surprise|
|Van Aanholt backs Lens to shine|
|Besiktas complete loan move for Gomez|
|McClaren: No decision on Coloccini future|
|Kane, Kaka hail goalkeeper Rimando|
|Chung eager to become FIFA president|
|Yedlin open to loan move|
|Tigres not scared of River trip - Ferretti|
|MLS Preview: Wright-Phillips, Lampard set to debut|
|´A draw is good for us´ - River´s Gallardo confident of Libertadores success|
|Di Maria poised for PSG switch - Blanc|
|Franjic: Bring on Bangladesh, Tajikistan|
|Van Gaal bemoans De Gea situation|
|MLS All-Stars 2 Tottenham 1: Kane stunner can´t spare Spurs|
|Manchester United 0 Paris Saint-Germain 2: Van Gaal´s defensive frailties exposed|
|Tigres UANL 0 River Plate 0: Visitors lose Gallardo in Copa Libertadores final first leg|
|Penedo parts ways with Galaxy|
|Benitez backs Mihajlovic, Milan to succeed|
|Barnetta joins Union in MLS|
|Allegri critical of Morata´s attitude|
|Franjic targets more A-League glory with City|
|Beto undaunted by Super Cup clash against Barca|
|Advocaat upbeat despite another Sunderland flop|
|McClaren praises Newcastle recruit Mitrovic|
|Payet will improve West Ham - Bilic|
|Pulis confirms interest in Lambert|
|Deila expects tough test in Baku|
|Drogba mobbed by Montreal Impact fans|