Egypt gained revenge for Friday's defeat in Kampala by beating Uganda 1-0 in Alexandria to leapfrog their opponents at the top of Group E.
Mohamed Salah scored the winner after six minutes, netting at the second attempt after Uganda goalkeeper Dennis Onyango blocked his first effort. Onyango's saves kept Uganda in the tie.
There were huge celebrations at the end among Egyptians, who have not been to the World Cup since 1990 despite winning four African titles since.
The North Africans now have nine points, Uganda seven, while Ghana - who have appeared at the last three World Cups - lie in third with five points after thumping Congo 5-1 in Brazzaville.
Congo, with just one point, can no longer qualify for next year's tournament in Russia.
Atletico Madrid midfielder Thomas Partey hit a hat-trick to inspire Ghana to their first win in the group - at the fourth time of asking - which came four days after being held to a 1-1 draw at home by the same opponents.
Partey, 24, scored his first international goal in that game.
Richmond Boakye grabbed a brace while Ukraine-born Vladis Illoy Ayyet scored a consolation for Congo.
Congo had started the game in Brazzaville strongly but were overpowered after Ghana opened the scoring against the run of play after 23 minutes through Boakye, with Partey doubling that lead just three minutes later.
In a topsy-turvy spell just before half-time, Illoy Ayyet scored his first goal for Congo after 43 minutes only for Partey to spin cleverly and fire home Christian Atsu's pass from a tight angle in first-half stoppage time.
With 21 minutes left on the clock, Partey resembled a seasoned striker as he lashed into the top corner after 69 minutes to seal his hat-trick.