Mohamed Salah scored from a free-kick as host nation Egypt defeated Uganda 2-0 in Cairo Sunday to win Group A at the Africa Cup of Nations with a perfect three-win record.
Pre-tournament favourites Egypt will remain in Cairo for the round of 16 and play one of the best four third-place finishers next Saturday.
After prolific Liverpool scorer Salah put Egypt ahead against the run of play on 36 minutes, captain Ahmed Elmohamady added a second just before half-time.
Uganda had plenty of possession in both halves and often threatened to score without managing to put the ball in the net.
Egypt topped the final standings with nine points and Uganda came next with four to also qualify automatically for the knockout phase.
The Democratic Republic of Congo came third with three points after trouncing Zimbabwe 4-0 in another Cairo stadium.
Uganda were more impressive than Egypt for the first 30 minutes on a hot night at a packed 75,000-capacity Cairo International Stadium.
Goalkeeper Mohamed Elshenawy did well to push a sizzling, long-range Allan Kyambadde drive over at the expense of a corner.
Abdu Lumala was a constant threat for the Cranes and had a shot and a header saved in quick succession with the Pharaohs defence not its normal assured self.
Salah then turned the tide toward the record seven-time African champions by lifting a free-kick over a defensive wall and past goalkeeper Denis Onyango into the corner of the net.
It was the second goal of the tournament for the Egyptian idol and Elmohamady notched his second in first-half stoppage time.
– Massive blow –
A low cross eluded two Egyptians, including Salah, but fell to Elmohamady, who unleashed a low shot that took a slight deflection en route to the far corner of the net.
It was a massive blow for the Ugandans, who did not deserve to be two goals behind as they walked to the changerooms.
The pace of Salah gave him a chance to score his second goal soon after the break, but Onyango made a superb one-hand block to foil the 2018 African Footballer of the Year.
Uganda regained their composure to cause constant problems for the home team, but lacked a clinical finisher like Salah.
At the 30 June Stadium in Cairo, the Democratic Republic of Congo put a two-loss start to the tournament behind them with a 4-0 triumph over Zimbabwe.
It was the biggest victory so far in the tournament, bettering the 4-1 win of Mali over Mauritania.
Jonathan Bolingi punished a blunder by goalkeeper Elvis Chipezeze to head the Congolese Leopards in front on four minutes and Cedric Bakambu added a second before half-time.
China-based Bakambu netted again midway through the second half and Britt Assombalonga added a fourth.
The Congolese will know only Tuesday night after the final group matches whether they are among the best four third-place finishers and remain in the competition.