They came from behind to defeat Latvia 5-2 at the Olympic Stadium in Athens.
Gekas opened the scoring for the hosts after four minutes but Maris Verpakovskis levelled with a superb bicycle kick before putting Aleksandrs Starkovs' team ahead just before half-time.
Gekas then netted a penalty two minutes after half-time after Giorgos Samaras was fouled by Oskars Klava, and the 29-year-old headed home Vasilis Torosidis's centre to put Greece ahead for the second time in the match.
Celtic frontman Samaras then scored with a clever overhead kick with 17 minutes left before Gekas tapped home his fourth and Greece's fifth goal in the first minute of added time to seal a result which puts Greece three points ahead of Latvia and three behind leaders Switzerland - 3-0 winners in Luxembourg - in the group with one match to go.
The hosts began at a high tempo and breached the Latvia defence at the first time of asking after four minutes, Gekas flashing a glancing header beyond Andris Vanins and in off the post.
Greece then sat back and were punished after 12 minutes when Latvia striker Maris Verpakovskis equalised with a brilliantly inventive overhead kick after Greece goalkeeper Alexandros Tzorvas had parried a long-range shot.
Georgios Karagounis responded for the hosts two minutes later, smashing a volley off the bar from 25 yards.
Verpakovskis almost put the visitors in front on 24 minutes but he volleyed Andrejs Rubins' long ball just past the right post with Tzorvas beaten.
Greece proceeded to lay siege to the Latvian penalty area but failed to break the visitors' rearguard despite winning a succession of corners.
And Greece were caught on the counter again by Verpakovskis in the 40th minute, the diminutive striker firing past Tzorvas after a clever lay-off by Girts Karlsons.
Greece began the second half with a frenetic pace and levelled the match just two minutes in when they were awarded a penalty after Samaras went down under Oskars Klava's challenge. Gekas stepped up to slot home from 12 yards.
The Bayer Leverkusen frontman had the crowd on their feet again 10 minutes later by heading Greece in front from Torosidis' superb cross to complete his treble.
A fourth goal was quick in coming and it was Samaras who scored it, swivelling to net with an overhead kick from close range 17 minutes from time after Vanins had parried Karagounis' cross.
Gekas was still not finished, however, and he prodded in after winning an aerial challenge with goalkeeper Vanins to complete the scoring.