Liverpool striker Mohamed Salah converted a stoppage-time penalty to give Egypt a dramatic 2-1 win over Congo on 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 on Saturday.
Egypt last qualified for the World Cup in 1990 with the record seven-time African champions suffering numerous heart-breaking failures since.
Following the win, Egypt's capital crackled with fireworks and blared with horns as the soccer-crazy country reacted to the news that the country had reached the World Cup for the first time in 28 years. It was a rare scenes of joy in Cairo.
"It's been 28 years and we're finally going to enter the World Cup. Today is a day of celebration for the entire country," said 41-year-old Gaber Fathy.
The raucous mood spilling out on the streets marked a respite for Egyptians after years of hardship, from IMF-backed austerity reforms that have pushed inflation to record highs to a tough law on protests that has made public gatherings exceedingly rare after two presidents were toppled since a 2011 uprising.
"You can look around and see how people are happy. This is something you never witness in Egypt," said 23-year-old Gamal Mohamed in downtown Cairo's Tahrir Square, the iconic centre of the country's once-active protest movement, which has since been quashed by tough security measures.
Egypt's President Abdel Fattah al-Sisi congratulated the Egyptian people after the match as tireless fans draped in flags turned the streets into an impromptu parade of red, white and black.
The desperation to qualify was so great ahead of the Congo match that Argentina-born Egypt manager Hector Cuper conceded he was taking medication for high blood pressure.
"I am taking hypertension medicine due to the stress I suffer from continuing criticism," he said 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.
Ian Hawkey: Salah the phoenix for his generation of Pharaohs
Richard Jolly: England end qualifying campaign with dull win
John McAuley: Syria keep hopes alive after a 1-1 draw