Nigeria thrashed Mozambique 3-0 to join champions Egypt in the knockout phase of the African Nations Cup from Group C on Wednesday.
Six-times champions Egypt saw off Benin 2-0 in Benguela to top the standings with a perfect record and nine points. Nigeria have six while Mozambique and Benin were eliminated with one point each.
The Pharaohs will play their quarter-final against the second-placed team in Group D in Benguela while Nigeria will be in Lubango to face the top side from that group.
Cameroon, Zambia, Tunisia and Gabon will battle it out for the two spots on Thursday.
Egypt, who stretched their unbeaten run at the Nations Cup to 16 matches, were barely bothered by a toothless Benin side in Benguela.
Defender Ahmed Al Muhammadi unleashed a long-range cross that caught Yoann Djidonou off guard in the seventh minute to put the Pharaos in front.
Ahmed Raouf's header was parried away by Djidonou, only for Emad Motaeb, to latch on to the ball and make it 2-0 after 23 minutes.
In a lively game played against the monotonous drone of plastic horns, Benin posed little threat in attack and only had one clear chance after the hour that was denied by a fine Essam El Hadari save.
Nigeria, who needed only a draw to advance, waited longer before overcoming Mozambique.
Peter Odemwingie, though, found the back of the net before and after the interval to dash Mozambique's hopes of reaching the quarter-finals for the first time.
The striker collected the ball outside the box and netted with a left-foot shot which found its way between Kampango and his near post.
Two minutes after resumption, Odemwingie struck again, turning in an easy chance after Yakubu Aiyegbeni broke down the left.
Obafemi Martins put the result beyond doubt four minutes from time when he hammered home a rebound.