Egypt's Mohamed Salah curled in a free kick, his second goal of this year's Africa Cup of Nations, to set them on the way to a 2-0 win over Uganda on Sunday as they topped their group while their opponents joined them in the last 16.
Ahmed Elmohamady was also on target as Egypt, who had already qualified, completed Group A with a 100 percent record in their three games and no goals conceded, while Uganda still qualified for the knockout stages for only the second time and the first since 1978.
The Cranes, who have four points, were given a helping hand by Democratic Republic of Congo, who thumped Zimbabwe 4-0 to finish third with three while Zimbabwe finished last with one.
Uganda were the better side for long periods but the game at Cairo stadium was effectively settled in a nine-minute spell before half-time when Salah and then Ahmed Elmohamady scored.
"The key was the timing, the moment of the first goal and the second were psychologically very important," said Egypt coach Javier Aguirre. "This is a game where you have to score more than the other team.
"The pressure is a lot. We tried to play... people want us to win, win, win. So far, we have nine points and we have to improve a lot of things."
Egypt broke the deadlock when they won a free kick 25 metres out and Liverpool's Salah curled his effort over the wall and into the bottom corner to send the stadium into raptures.
Mahmoud Trezeguet set up the second goal when he charged down the left and, although his cross evaded Salah, Elmohamady collected the ball and drove it into the net.
Until then little went right for Salah as his teammates attempts to find him with through balls invariably failed.
Uganda strung together some delightful passing moves, with Farouk Miya at the centre of most of them, and troubled the hosts with their pace down the flanks.
Allan Kyambadde, in particular, was a constant menace and almost caught out Mohamed El Shenawy with a dipping shot which the Egypt goalkeeper managed to tip over.
El Shenawy also had to make a double save from Lamula Abdu, first blocking the Ugandan's shot from a difficult angle and then saving his header from the rebound.
Uganda continued to press in the second half without success.
Miya had a dangerous effort deflected over by a defender, then curled a free kick onto the roof of the net while Egypt defender Ayman Ashraf nearly turned Khalid Aucho's low cross into his own net.
"We are disappointed about the result because we missed a lot of chances," said Uganda coach Sebastien Desabre. "Unfortunately, in football the most important thing is to score and we didn't have success in that aspect.
"But we deserved to qualify and for me, that's the most important thing."