Former Continent's Best Player of the Year Victor Osimhen was instrumental in his team build a 3-0 lead, but the Super Eagles were forced to hold on for a narrow win.
The three-time champions weathered a stunning comeback attempt from Tunisia to advance to the knockout stage of the 2025 Africa Cup of Nations being held in Morocco.
Jose Peseiro's side appeared to be in complete control in their Group C encounter in Fes, enjoying a three-goal cushion with only 17 minutes remaining thanks to goals from their attacking trio.
Yet, Montassar Talbi pulled one back with a close-range finish from a Manchester United midfielder free-kick, sparking hopes of a recovery.
The tension escalated when the North Africans were awarded a spot-kick after a VAR check spotted a handball by Bright Osayi-Samuel. Ali Abdi calmly slotted home in the 87th minute to create a nail-biting finale.
The Carthage Eagles came agonizingly close from a last-gasp equalizer in added time, with captain Ferjani Sassi directing a chance narrowly wide before Ismael Gharbi sent a bobbling volley wide of the upright.
This result ensures that Nigeria, winners of the tournament on 3 previous occasions, advance to 6 group points and are assured first place in Group C with one game still to be contested.
In the next round, they will meet a best third-place team from one of the other preliminary groups.
In the other match, Tunisia stay on 3 group points, with Uganda and Tanzania locked on one point each after playing out a one-all draw in the day's other fixture.
The final pool matches will see the group leaders stay in Fes to take on Uganda on Tuesday, while the Eagles of Carthage travel back to Rabat to face Tanzania.
The Tunisian defender drilled home from the penalty spot to give Tunisia hope of snatching a draw.
The Super Eagles, runners-up in the 2023 edition, become the second nation after the Pharaohs to qualify for the knockout stage, but their manager and supporters will undoubtedly be feeling relieved.
What seemed set to be a comfortable last period morphed into a nerve-wracking conclusion.
Victor Osimhen had a goal ruled out for offside before breaking the deadlock right before half-time, precisely placing a glancing effort into the far post from an Ademola Lookman delivery.
The advantage was doubled soon in the second half when Wilfred Ndidi rose highest to thump in a header from a set-piece kick.
Osimhen then set up his teammate for the third goal, only for the defender to direct a powerful header past goalkeeper Stanley Nwabali to begin the comeback.
The key incident came when a high ball struck the forearm of Bright Osayi-Samuel, with referee Boubou Traore pointing to the spot after consulting the VAR monitor.
Despite Ali Abdi's successful penalty, the 2004 champions in the end fell short of completing a remarkable comeback.
Tunisia's destiny is still in their own hands; a point against Tanzania will be enough to see them through, and manager Sami Trabelsi will be eager to avoid a repeat of the 2013 group-stage exit that led to his departure.
A passionate storyteller and writer focused on sharing authentic experiences and creative inspirations.