Brazil: At Fortaleza, Ivory Coast were seconds away from making the knockout stage when Samaras was judged to have been tripped in the box by Giovanni Sio as the Greeks poured forward in search of a winner.
Samaras picked himself up after a debatable decision and kept his cool to stroke home the spot kick and make it 2-1, triggering wild celebrations during which the striker was buried under team mates who knew theirs was the narrowest of escapes.
"The end result is cruel, even if the Greeks deserved this victory," said crestfallen Ivory Coast coach Sabri Lamouchi. "We could have had the match stopped one minute earlier. We saw that everything is in the details. It's very tough, it's very hard."
The Greeks, who had failed to get past the group stage at their two previous appearances at the World Cup, will face Costa Rica in Recife on Sunday in the last 16.
READ MORE
Kenya's Emerging Stars face stern Ivory Coast test in U-23 AFCON qualifying race
History makers Junior Starlets face Japan test today
From underdogs to giant slayers
Junior Starlets thump Samoa 4-0, make history with World Cup last-16 breakthrough