Algeria held Nigeria to a 0-0 draw in their final Group B game at Stade Léopold Sédar Senghor in Dakar.
The result meant both teams ended on five points but the North Africans finished top of the group on goal-difference.
Egypt could not get the win that would have put them in contention for a top-two finish after losing 1-0 to Mali in the group’s other game. Ragab Abdelnabi was the unfortunate scorer of an own-goal.
Owen da Gama’s side will therefore lock horns with Algeria, who so far in the tournament have drawn 1-1 with Egypt, beaten Mali 2-0 and drawn 0-0 with Nigeria.
The semi-finals, both to be played on Wednesday, 9 December, are as follows.
17h00 Senegal vs Nigeria
20h30 Algeria vs South Africa