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.
Progress report: Mark Milligan
With the AFC Asian Cup appearing quickly on the horizon, we’re delivering weekly scouting reports on some of our Caltex Socceroos playing abroad. This week the spotlight is on Mark Milligan, an experienced member of the national team who has made a flawless start to life in Eu
Caltex Socceroos meet young Aussie ‘Playmakers’ in the UAE
The Caltex Socceroos took time out after training to meet with some young Australian fans in the United Arab Emirates last week ahead of Monday’s solid 4-0 win over Kuwait in Kuwait City. The young Australians, who live in the UAE, are part of the AFC Asian Cup UAE 2019’s Play
‘An amazing story’: Patrice Evra leads social media tributes to Mabil, Deng debuts
There was a lot to like about the Caltex Socceroos win over Kuwait on Tuesday (AEDT) but arguably the biggest highlight was the international debuts of youngsters Awer Mabil and Thomas Deng. The pair were both second-half substitutes and combined on the right flanks, with Mabi
Stats review: Breaking down the Caltex Socceroos win over Kuwait
The Caltex Socceroos made a blistering start to the Graham Arnold era on Tuesday morning (AEDT) with their emphatic 4-0 win over Kuwait. The performance and result not only made a big statement of what this Australian team is set to deliver under their new boss, but also snapp