Liverpool forward Mohamed Salah converted a stoppage-time penalty to give Egypt a dramatic 2-1 win over Congo Brazzaville Sunday and a place at the 2018 World Cup in Russia.
Salah put Egypt ahead during the second half in Alexandria only for Arnold Bouka Moutou to equalise two minutes from the end of regular time.
Victory gave Egypt an uncatchable four-point lead over Uganda in Group E with one round of fixtures remaining.
Uganda were held 0-0 by Ghana in Kampala Saturday.
A defensive blunder allowed constant menace Salah to fire past goalkeeper Barel Mouko on 63 minutes at the 85,000-capacity Borg El Arab Stadium.
But Congo threatened to turn party-poopers as substitute Moutou, a France-based defender, beat 44-year-old goalkeeper Essam El Hadary from inside the box.
A draw would not have been enough for Egypt to seal qualification and they sought a winning goal, which came when Salah sent Mouko the wrong way with his spot-kick.
Egypt last qualified for the World Cup in 1990 with the record seven-time African champions suffering numerous heart-breaking failures since.
The desperation to qualify was so great ahead of the Congo match that Argentina-born Egypt coach Hector Cuper admitted he was taking medication for high blood pressure.
"I am taking hypertension medicine due to the stress I suffer from continuing criticism," he told reporters without specifying who his critics were.
"Life is full of stress, but the challenge of reaching the World Cup is the toughest stress I have faced."
Egypt also beat Congo away and Ghana and Uganda at home to accumulate 12 points, with the only loss away to Uganda.
Nigeria became the first African qualifiers Saturday with a 1-0 Group B win over Zambia in Uyo thanks to a goal from another English Premier League player, Alex Iwobi of Arsenal.
Tunisia or the Democratic Republic of Congo will qualify from Group A and Morocco or the Ivory Coast from Group C.
All four Group D teams - Senegal, Burkina Faso, Cape Verde and South Africa - are in contention to finish first with the final matchday scheduled for November.