Liverpool forward Mohamed Salah scored twice in a 2-1 win over Congo to secure a World Cup berth for Egypt for the first time in 28 years.
After Ghana and Uganda drew 0-0 on Saturday in Group E, Egypt needed a win in Sunday evening's match to make the cut for Russia 2018 in the penultimate round of qualifying, reports Efe news agency.
Salah managed to break the deadlock in the 63rd minute, when he capitalised on a defensive error to sprint into the Congo penalty area and unleash a shot that found the back of the net.
It seemed that Egypt's dream was in jeopardy when Arnold Bouka Moutou equalised for Congo with two minutes left in regulation time.
Egypt, however, were awarded a penalty five minutes into stoppage time and Salah converted to spark wild celebrations in the stands at the Borg El Arab Stadium.
The most recent of Egypt's two previous World Cup appearances was in 1990.
Egypt became the second African country to secure a place in next year's tournament, following Nigeria.