Georgios Samaras struck an injury-time penalty as Greece snatched a place in the World Cup last-16 with a dramatic 2-1 win over Ivory Coast.
The African side had looked to be going through to the knockout stages as Group C runners-up after Swansea's Wilfried Bony cancelled out Andreas Samaris' first-half strike in the 74th minute in Fortaleza.
But Greece, who hit the woodwork three times, showed considerable improvement on their earlier performances in the tournament and grabbed victory after Samaras -- recently released by Celtic -- was felled late on.
It was no less than the Greeks deserved for an enterprising performance after a slow start.
The Ivory Coast players were wearing black armbands in memory of Ibrahim Toure, the brother of team members Yaya and Kolo Toure who died last week.
Both Toures were in the side, having opted to remain with the squad in Brazil, on what was undoubtedly an emotional occasion for the pair.
Powerhouse former Chelsea forward Didier Drogba was also included in the starting lineup as the Elephants looked to his experience to help guide them into the last 16.
But the Africans struggled to get into their stride, possibly hindered by the stop-start opening to the game that saw Greece lose two players to injury in the opening 25 minutes.
Coach Fernando Santos had already made one notable enforced change having brought in 37-year-old Georgios Karagounis for his 138th cap in place of suspended captain Konstantinos Katsouranis.
He was forced to make another with just 12 minutes gone as Panagiotis Kone went down with a hamstring injury.
It proved a significant moment as Samaris took his place but initially the game seemed to gather no momentum, with goalkeeper Orestis Karnezis calling for treatment soon after.
After a lengthy stoppage he tried to play on, but soon accepted defeat and was replaced by Panagiotis Glykos.
What broken play there had been by then had seen Ivory Coast looking to counter but a dangerous Yaya Toure cross for Drogba was cut out by Karnezis in his last significant involvement.
Greece suddenly burst into life just after the half hour as they caught Ivory Coast with a swift break from deep.
Samaras broke clear and played in Jose Cholevas, who slammed a shot against the bar from the edge of the area.
Another chance came after Samaras was impeded attempting to reach the rebound but Karagounis shot straight at Boubacar Barry from the resultant free-kick.
Gervinho and Salomon Kalou combined to threaten for Ivory Coast but Greece crowded them out and snatched the lead three minutes before the break.
Newcastle's Cheick Tiote sold his defence short with an under-hit back pass and Samaris nipped in to race through on goal and clip a cool shot over Barry.
Yaya Toure tried to drag Ivory Coast back level before the break but he was unable to finish after a strong run and Samaris blocked his scuffed shot.
Greece dictated the tempo early in the second half with Lazaros Christodoulopoulos bending a shot narrowly wide and Dimitrios Salpingidis striking at Barry from distance.
Karagounis then rattled the bar with a well-struck effort from 40 yards.
Ivory Coast needed to respond and Souleymane Bamba flashed a header narrowly wide. They broke through after 74 minutes as Kalou slipped in Gervinho and the former Arsenal man pulled the ball back neatly for Bony to finish from in front of goal.
Greece fought to the end and a cross from Vasileios Torosidis caused alarm when it drifted against the post.
Salpingidis also whipped in a dangerous ball across the face of goal but it evaded everybody and rolled to safety.
The greatest drama was still to follow as Samaras was upended in injury time by substitute Giovanni Sio and the referee pointed to the spot.
Samaras stepped up and coolly fired home.