Alex Iwobi scored the winning goal as Nigeria recovered from behind to beat Africa Cup of Nations champions Cameroon 3-2 in a topsy-turvy last-16 clash in Alexandria on Saturday.
Both teams suffered disappointing results in their final group matches to finish second and set up a heavyweight showdown that more than lived up to its hype.
And it was the Super Eagles who came out on top on Saturday to set up a showdown with either hosts Egypt or South Africa in the next round after recovering from a 2-1 half-time deficit.
Stephane Bahoken and Clinton N'Jie had struck late in the first half for the 2017 winners to cancel out Odion Ighalo's opener, but the former Watford striker bagged his second with just over an hour played to level things up and Arsenal winger Iwobi completed the comeback three minutes later.
Nigeria had won six AFCON matches in a row prior to their shock defeat against Madagascar in their previous outing and they made a bright start before the first of Ighalo's goals 19 minutes in.
A cross to the back post was scuffed across goal by Kenneth Omeruo and Ighalo was in the right place to divert it past Andre Onana with the help of a deflection.
Cameroon turned the game on its head as half-time approached, however, with Bahoken playing a key part in the turnaround.
The Angers striker volleyed home from six yards to make it 1-1 after being picked out by Christian Bassogog and he then flicked a long ball on for N'Jie to slot past Daniel Akpeyi.
But three-time winners Nigeria showed character of their own to get themselves back on level terms through Ighalo's cool first-time finish from eight yards and Iwobi showed just as much composure to beat Onana.
Ighalo was denied a hat-trick by a fine save 14 minutes from time, but Gernot Rohr's side saw things through to secure a place in the last eight.