Nigeria defeated Benin 2-0 here on Tuesday to set up an enticing quarter-final clash against hosts Ghana in the 2008 Africa Cup of Nations.
The Super Eagles needed to win by at least two clear goals against Benin and hope Ivory Coast beat Mali to qualify for the last eight of the tournament.
The Nigerians will go on to beat Benin and finish on four points while the Ivorians stopped Mali 3-0 to top Group B with maximum nine points. Mali ended with four points but went out of the competition on goal difference to Nigeria.
"We asked for something of a miracle and it happened. We are now up against the host team and if we want to progress in this competition, we will have to beat them as well," said Osaze Odemwingie, who though will miss the game after he picked up his second booking against Benin.
"We showed great mental strength and that is what we will need again on Sunday. Rule us out at your own risk.
"We gave a good account of ourselves but Nigeria were more determined to carry the day. We wish them the best of luck against Ghana on Sunday," said Benin striker Razak Omotoyossi, whose parents are Nigerians.
Chelsea midfielder Mikel John Obi put Nigeria in front with a header from the near post in the 52nd minute after Benin goalkeeper Yoann Djidonou failed to hold a powerful free kick by Taye Taiwo.
Yakubu Aiyegbeni doubled Nigeria's advantage in the 85th minute after he was released by a long ball by Obi.
Dickson Etuhu, John Utaka and Ikechukwu Uche were the three changes in the Nigerian starting eleven as Obafemi Martins and Obinna Nsofor were relegated to the bench while Seyi Olofinjana was suspended. Nwankwo Kanu was again ruled out of action due to injury.
In the first half, Nigeria's Yakubu Aiyegbeni missed a great chance after just two minutes of action when he failed to hit target when he worked his way inside inside the 18-yard box but his final ball screamed past the post.
The Super Eagles continued to pile on the pressure but, without the influential Kanu, either lacked creativity going forward or their final ball often let them down as Benin also responded with a few attacks of their own.
Jonas Oketola's diving header off a corner in the 17th minute screamed past the face of the Nigerian goal as Benin created a good chance. That must have lifted the confidence of the Squirrels as they settled down and began to attack.
In the 28th minute Osaze Odemwingie's cross from the left flank was saved by young goalkeeper Yoann Djidonou, who was preferred to the more experienced Rachid Chitou, with hard working Aiyegbeni lurking inside the box to pounce.
Desperation began to set in the Nigerian attack as Benin continued to soak the pressure and even moved upfield to launch their own attacks.
Mikel Obi summed up a rather lethargic first-half performance by Nigeria when he ran into the Benin area but his final effort missed the mark by miles for both teams to go into the dressing room on level terms.
Almost immediately from the restart substitute Muri Ogunbiyi came close to asserting himself in this west African derby when his clever lob was tipped for a corner by Austin Ejide.
Odemwingie responded for Nigeria moments later but his snatched shot from inside the box rolled into touch. Mikel's long ball then releasd Aiyegbeni but goalkeeper Yoann Djidonou.
The goalkeeper failed to hold a resulting free kick by Taye Taiwo allowing Odemwingie to send a cross for Obi to connect home with his head for the first goal.
Uche would have doubled the lead in the 62nd minute when he turned well inside the box but his shot was saved by goalkeeper at second attempt. And four minutes later Chievo Verona ace Nsofor could only watch as his header off a corner crashed against the woodwork.
To their credit, Benin did not give up the fight and kept going at their opponents. Dangerman Razak Omotoyossi should have drawn the teams level in the 71st minute but he hesitated in front of goal to give the Nigerian defence eneough time to clear.
Nsofor would have made it two for Nigeria in the 83rd minute but he wasted a glit-edged chance with only the goalkeeper at his mercy. Aiyegbeni then wrapped up the win after a long ball from Mikel.