Two late goals from Obafemi Martins gave Nigeria their third successive victory at the African Nations Cup with a 2-1 win over Senegal.
Senegal, who finished second on goal difference in Group D, qualified for the quarter-finals after World Cup finalists Ghana suffered a shock 2-1 defeat by Zimbabwe in Ismailia.
Martins grabbed an 88th-minute winner for the Super Eagles after he had equalised nine minutes earlier, both close-range efforts set up by substitute Nwankwo Kanu.
Senegal had taken a first-half lead through Souleymane Camara.