Substitute Abdallah El Said scored a late winner for Egypt to knock Uganda out of the Africa Cup of Nations.
After a drab game with few chances for either side, Mohamed Salah teed up El Said, who struck firmly past Uganda keeper Denis Onyango on 89 minutes.
Uganda’s Joseph Ochaya earlier had a goal correctly disallowed for offside.
The win means Egypt play Ghana on Wednesday with top spot of Group D still at stake, while Uganda are out of their first tournament since 1978.
Ghana secured their place in the quarter-finals with a 1-0 victory over Maliearlier on Saturday.
On a deteriorating pitch in Port-Gentil, seven-times champions Egypt failed to break down a resolute Cranes defence for long periods.
Onyango made an impressive clearing header to deny the onrushing Salah at the end of an otherwise lifeless first half.
Uganda began the second half brightly, forcing veteran Egypt goalkeeper Essam El Hadary to punch several set-pieces clear but ultimately failed to register a shot on target as Ochaya turned in Faruku Miya’s through ball from a clearly offside position on 52 minutes.
El Said blasted a shot well over when unmarked and Marwan Mohsen went close for the Pharaohs with a header, but Egypt appeared to be heading for their second consecutive goalless draw.
However, an otherwise quiet Salah showed great composure late on to check his shot and play in El Said with a reverse pass, the substitute’s close-range shot evading Onyango.
Uganda now face Mali in the final round of group games on Wednesday, with Mali needing a win and for Ghana to beat Egypt by two goals or more if they are to qualify.