Ramadan Sobhy's second-half strike all but secured Egypt's place at the 2017 Africa Cup of Nations as a 1-0 win ended Nigeria's hopes of reaching Gabon.
Chad's withdrawal from qualifying Group G, reportedly for financial reasons, meant all points against the nation were discarded and that no best runners-up spot would be available, leaving Nigeria with a must-not-lose situation in Alexandria.
But Egypt, whose own preparations were hindered by an election-rigging scandal engulfing the country's football association, were the far superior side and Ahmed Hegazy and Ramy Rabia missed great first-half chances.
Hector Cuper's men were not to be denied, though, and Sobhy's soft effort had enough to beat Nigeria goalkeeper Daniel Akpeyi to earn the three points.
Nigeria can now no longer overtake Egypt as they are five points adrift with just one match to play, while Egypt are also six points clear of Tanzania - who have two games left - with a far superior goal difference.
Egypt started the brighter and Hegazy should have done better when he headed Mohamed Salah's free-kick wide when unmarked in the box.
Odion Ighalo was wayward with a half-volley in the penalty area in Nigeria's best chance of the half, but Egypt continued to press and captain Abdallah Said dragged an effort wide of the right-hand post.
Akpeyi was then on hand to make a smart stop from Ibrahim Salah's edge-of-the-area shot, before tipping Rabia's flicked header over the crossbar.
Arsenal midfielder Mohamed Elneny struck over the bar for Egypt shortly after the restart, while the lively Victor Moses was denied by Hegazy's timely block at the other end.
The hosts' pressure finally told in the 66th minute, though. Salah's corner was not dealt with and Sobhy's tame shot squirmed through several Nigeria defenders and under a despairing Akpeyi, who could have done better.
Nigeria piled on the pressure in the closing stages and Moses saw a 20-yard left-foot effort rebound cruelly off the right post but, despite their best efforts, Egypt held on for the win.
Get the best features, fun and footballing frolics straight to your inbox every week.