Substitute Abdallah El Said struck an 89th-minute winner to seal a 1-0 victory over Uganda and boost Egypt’s hopes of reaching the African Nations Cup knockout stages.
El Said’s effort means Arsenal’s Mohamed Elneny and his team-mates will head into Wednesday’s final Group D clash with already-qualified Ghana needing just a point to progress, while Uganda are eliminated.
Egypt made the better of appalling pitch conditions in Port-Gentil to dominate the early exchanges as they looked to improve on their disappointing opening draw against Mali.
Ramadan Sobhi caused early problems and almost set up a good chance for Trezeguet, while former Chelsea star Mohamed Salah also looked sharp.
Tarek Hamad fired just over the bar in the 33rd minute but the Ugandans slowly got to grips with proceedings and stemmed the one-way flow before half-time.