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'
|Lovren determined to make amends after nightmare showing|
|Llorente laments Sevilla luck|
|Monk: Shelvey worthy of England selection|
|Sabatini apologises to Genoa over Iturbe U-turn|
|MLS Review: Red Bulls keep DC down, Sounders trump Timbers|
|Martinez: Stones didn´t mean to submit transfer request|
|Simeone hails Atletico performance|
|Di Maria: I was impatient to play|
|La Liga Review: Eibar down Supercopa holders|
|Raul Garcia set to join Bilbao|
|Garcia confident Roma are heading in the right direction|
|Serie A Review: Roma punish 10-man Juve, Eder thwarts Napoli|
|Mancini demands killer instinct from Inter after Carpi scare|
|Allegri praises Juve spirit in poor display at Roma|
|Monaco 0 Paris Saint-Germain 3: Cavani up and running as PSG march on|
|Carpi 1 Inter 2: Jovetic double settles lacklustre encounter|
|Sevilla 0 Atletico Madrid 3: Hosts thwarted once again by Simeone|
|Inter land Wolfsburg´s Perisic|
|Shelvey and Vardy named in England squad|
|Montero injury nothing serious - Monk|
|Van Gaal in the dark over De Gea future|
|Werder Bremen 2 Borussia Monchengladbach 1: Vestergaard seals first win|
|Roma 2 Juventus 1: Pjanic and Dzeko down stuttering champions|
|United could not cope with Swansea - Van Gaal|
|Monk: Swansea are a Premier League force|
|Lyon swoop for Malaga midfielder Darder|
|Tuchel hails table toppers Dortmund|
|No complaints for Neil after Southampton loss|
|Swansea City 2 Manchester United 1: Gomis spoils Van Gaal´s day|
|De Bruyne relieved to complete City switch|
|Koeman stands firm over Mane and Wanyama futures|
|Bahebeck rushed to hospital with chest pains|
|Borussia Dortmund 3 Hertha Berlin 1: Tuchel maintains perfect start|
|Manchester City complete De Bruyne swoop|
|Weihrauch strikes twice as Bayern overpower fans|
|Saint-Etienne 2 Bastia 1: Two sent off in first defeat of the season for visitors|
|Southampton 3 Norwich City 0: Tadic at the double for Koeman´s men|
|Paderborn swoop for Kirch|
|Bayern loan Coman from Juventus|
|Schalke will not rush decision over Wolfsburg target Draxler|
|Fenerbahce secure Markovic loan|
|O´Neill trims Ireland squad to 28|
|Sherwood: I´ve done my hamstring|
|Dante set for Wolfsburg switch|
|Neymar knows nothing of Man United interest|
|Ibisevic leaves Stuttgart for Hertha|
|International break unwelcome for Mourinho|
|Muto a ´perfect fit´ for Mainz|
|Lampard pledges NYC commitment|
|Van Gaal: I listen to Rooney|
|MLS Review: Whitecaps falter, Eastern Conference heats up|
|´I think a yellow would have been harsh´ - Noble baffled by his red card|
|Rodriguez´s quality ´unquestionable´ - Benitez|
|Abdennour chooses Valencia|
|Giovinco to fly to Italy despite injury|
|La Liga Review: Real Madrid, Celta notch big wins|
|Mihajlovic: I feel like I lost|
|Real Madrid 5 Real Betis 0: Rodriguez scores twice in Benitez´s first Bernabeu win|
|Balotelli has a lot of work to do, declares Bacca|
|Luis Enrique delighted with Vermaelen´s form|
|Bundesliga Review: Leverkusen no match for Muller-inspired Bayern, Frankfurt thump Stuttgart|
|Milan 2 Empoli 1: Adriano header seals first league win for Mihajlovic|
|Ligue 1 Review: Fekir hat-trick inspires Lyon, Reims take Lorient apart|
|Barcelona 1 Malaga 0: Vermaelen rewards patient champions|
|Muller denies Van Gaal contact|
|Pochettino not concerned about goalless Kane|
|Martinez hails ´immense´ Stones|
|Flores not concerned by lack of Watford goals|
|Evans completes West Brom switch|
|Howe remains upbeat despite concerning injuries|
|Rash Cattermole frustrating Advocaat|
|Bayern Munich 3 Bayer Leverkusen 0: Muller marks 200th appearance in style|
|Tottenham 0 Everton 0: Howard keeps hosts at bay|
|Sako gives Palace new dimension - Pardew|
|Rodgers rues self-inflicted Liverpool defeat|
|Villa were robbed during Sunderland draw, blasts Sherwood|
|Football League Review: Brighton move top, Orient maintain winning start|
|I wish I had a fourth substitute, says Chelsea boss Mourinho|
|Pulis hails West Brom match-winner Rondon|
|´Gladiator´ spirit is more important than anything - Ranieri|
|Bilic defends ´park the bus´ tactics after Anfield win|
|Pellegrini quiet on De Bruyne after record-breaking win|
|Hughes fumes at Stoke dismissals after West Brom loss|
|Mourinho: Chelsea did not deserve Palace defeat|
|Scottish Premiership Review: Celtic return to the summit as Hearts suffer surprise defeat|
|Liverpool 0 West Ham 3: Defensive woes return for Rodgers´ men|
|Manchester City 2 Watford 0: Sterling opens account as City become record breakers|
|Bournemouth 1 Leicester City 1: Vardy rescues a point|
|Chelsea 1 Crystal Palace 2: Late Ward winner seals dramatic victory|
|Stoke City 0 West Brom 1: Rondon gives Pulis win over nine-man hosts|
|Aston Villa 2 Sunderland 2: M´Vila and Lens secure hard-fought point|
|Blackett moves to Celtic on loan|
|McClaren laments ´harsh´ Mitrovic red|
|Wenger: Arsenal ´cautious´ in Newcastle win|
|Sevilla can mirror Atletico strengths - Simeone|
|Ibrahimovic and Di Maria in PSG squad for Monaco clash|
|Newcastle United 0 Arsenal 1: Mitrovic off as Coloccini own goal settles it|
|Barca´s Suarez ends Sevilla loan to make Villarreal switch|
|Allegri confirms imminent Coman departure|
|Garcia demands more ahead of Juve clash|
|Knee injury sidelines Ozil|
|Dortmund boost defence with Mainz´s Park|
|Ruddy hoping to impress Hodgson|
|Wolfsburg proved there is life after De Bruyne - Hecking|
|Van Gaal unsure if Romero will replace De Gea long-term|
|Dzeko wants Totti partnership at Roma|
|No excuses for City - Pellegrini|
|San Jose Earthquakes 1 LA Galaxy 0: Salinas´ header levels Cali Clasico tally|
|Koeman plays down expectations|
|Stuttgart´s Langerak suffers surgery setback|
|Rodgers hails Milner´s leadership, mentality|
|Conte hints at Giovinco recall, doesn´t rule out Balotelli|
|Martinez slams Chelsea over Stones pursuit|
|Leverkusen are title contenders - Guardiola|
|Babel in sexism controversy|
|Pellegrini prepared to wait for Otamendi|
|Sevilla v Atletico Madrid: Llorente hoping to repay faith|
|Veloso back for Portugal|