Record seven-time champion Egypt beat neighboring Sudan 1-0 Wednesday to secure its place in the Africa Cup of Nations last 16 while taking five other countries including Ivory Coast through as well.
Nigeria finished Group D with a third successive win as it beat Guinea-Bissau 2-0, leaving runner-up Egypt to face the winner of Group E in the next round and a potential clash with the Ivorians.
Mohamed Abdelmonem's header at a corner 10 minutes before half time in Yaounde sent the Pharaohs through and eliminated Sudan, and also saw Ivory Coast, Mali, Gambia, Malawi and Cape Verde qualify without kicking a ball.
"I think Egypt deserved to win this game without any doubt given the opportunities we created and the football we played," said Egypt coach Carlos Queiroz.
"Our sin was not to score the second goal. If you score the second goal the game is finished. I will say it very clear, if I'll be able to win all the games 1-0 till the end I will be happy."
Egypt's victory guaranteed Cape Verde and Malawi will qualify as two of the four best third-placed sides. Ivory Coast leads Group E with four points and can finish no lower than third regardless of its result Thursday against reigning champion Algeria.
The same applies to Gambia and Mali in Group F. Both nations have four points from two games.
Three-time former winner Nigeria continued its fine start to the competition by sweeping aside Guinea-Bissau courtesy of second-half goals from Umar Sadiq and captain William Troost-Ekong.
Nigeria caretaker coach Augustine Eguavoen made eight changes to his team with the top spot already secure, but it was Kelechi Iheanacho – the match-winner against Egypt – who supplied the cross for Sadiq to tap in on 56 minutes.
Moses Simon came off the bench and played the main role in Nigeria's second goal, twisting past two defenders in the box before hammering a shot against the crossbar.
Troost-Ekong turned in the rebound from close range, with an initial offside decision against the defender overturned by video assistant referee (VAR).
The Super Eagles will stay in Garoua to play a third-placed team in the last 16 on Sunday.
Cape Verde will take on Sadio Mane's Senegal in Bafoussam on Jan. 25, while Malawi will meet Morocco on the same day in Yaounde after reaching the knockout rounds for the first time.
The remaining three slots will be determined Thursday after the final round of matches in Group E and Group F.
Algeria, whose 35-match unbeaten run was ended by Equatorial Guinea, must beat Ivory Coast in Douala to avoid a shock early exit after picking up just one point from two games.
The Equatoguineans are second in the section going into their game with Sierra Leone, who held Algeria 0-0 in its opener and then snatched an injury-time equalizer to draw 2-2 with Ivory Coast.
Tunisia could be without 12 players including skipper Wahbi Khazri against surprise Group F leader and debutant Gambia because of COVID-19.
The Carthage Eagles, the 2004 winners, will qualify for the last 16 unless they suffer a defeat by six goals or more.