Former Continent's Best Player of the Year Victor Osimhen was instrumental in Nigeria build a commanding lead, but the Super Eagles were compelled to defend resolutely for a narrow win.
Nigeria survived a dramatic late rally from Tunisia to advance to the last 16 of the 2025 Africa Cup of Nations taking place in Morocco.
Jose Peseiro's side seemed to be in complete control in their Group C clash in the Moroccan city, holding a three-goal lead with just a quarter of an hour remaining thanks to strikes from their attacking trio.
However, a Tunisian defender reduced the deficit with a close-range finish from a Hannibal Mejbri set-piece, igniting hopes of a recovery.
The drama intensified when the North Africans were given a late penalty after a video assistant referee check identified a handling offense by Bright Osayi-Samuel. The left-back calmly slotted home in the dying stages to set up a nail-biting conclusion.
Tunisia came agonizingly close from a last-gasp equalizer in stoppage time, with their skipper directing a chance narrowly wide before a substitute guided a bobbling volley past the goal frame.
The victory means that Nigeria, winners of the competition on 3 previous occasions, move to 6 group points and are assured top spot in Group C with a match left to play.
In the next round, they will face a best third-place side from either the other preliminary groups.
In the other match, Tunisia remain on three points, with Uganda and Tanzania locked on one point each after playing out a 1-1 stalemate in the day's other fixture.
The concluding pool fixtures will see Nigeria stay in Fes to play Uganda on the next matchday, while the Eagles of Carthage return to the capital to confront the Taifa Stars.
Ali Abdi smashed home from 12 yards to give Tunisia hope of snatching a point.
The Super Eagles, runners-up in the previous edition, become the next team after the Pharaohs to reach the next phase, but coach Eric Chelle and supporters will undoubtedly be feeling relieved.
What looked like set to be a comfortable last period transformed into a nerve-wracking affair.
The prolific striker had a effort disallowed for an infringement before breaking the deadlock right before half-time, expertly guiding a header into the far post from an Atalanta winger delivery.
The lead was doubled soon in the second half when the Leicester City midfielder climbed above everyone to power home a powerful nod from a set-piece corner.
Osimhen then turned provider Lookman for the third goal, before Montassar Talbi to steer a powerful header past the Nigerian shot-stopper to initiate the comeback.
The key moment came when a looping cross hit the forearm of Bright Osayi-Samuel, with referee Boubou Traore pointing to the spot after consulting the pitchside screen.
Despite Ali Abdi's confident conversion, Tunisia ultimately came up just short of pulling off a stirring comeback.
Tunisia's destiny is still in their control; a point against Tanzania will be enough to secure progression, and manager Sami Trabelsi will be keen to avoid a repeat of the past group-stage exit that resulted in his departure.
A former casino floor manager turned slot analyst, Mikael shares data-driven insights to help players make smarter betting decisions.