Liverpool forward Mohamed Salah converted a stoppage-time penalty to give Egypt a dramatic 2-1 win over Congo Brazzaville 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 on Sunday.
Victory gave Egypt an uncatchable four-point lead over Uganda in Group E with one round of fixtures remaining.
Uganda was 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.
READ: Drogba hails Salah for Egypt heroics
But Congo threatened to turn party-pooper 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 it 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 qualifier on 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.
Latest on Sportstar
- Why is the England vs Ireland Lord’s Test a four-day game?
- French Open: Sabalenka, Djokovic hoping to steer clear of controversy
- ENG vs IRE Test, day 1: England takes control against Ireland as Broad stars with ball
- ‘I will continue’: Ronaldo says he’ll stay in Saudi
- India wins Junior Asia Cup, beats Pakistan 2-1