Former African Footballer of the Year Victor Osimhen helped his team build a 3-0 advantage, but the Super Eagles were compelled to hold on for a hard-fought victory.
The three-time champions weathered a dramatic comeback attempt from Tunisia to progress to the knockout stage of the Afcon tournament being held in the host nation.
The Super Eagles appeared to be cruising in their Group C encounter in Fes, enjoying a three-goal lead with only a quarter of an hour remaining courtesy of goals from Victor Osimhen, Wilfred Ndidi and Ademola Lookman.
Yet, a Tunisian defender pulled one back with a powerful header from a Manchester United midfielder free-kick, igniting hopes of a turnaround.
The drama intensified when Tunisia were given a late penalty after a VAR check identified a handling offense by Bright Osayi-Samuel. The left-back converted in the 87th minute to set up a nail-biting finale.
The Carthage Eagles were inches away from a last-gasp equalizer in stoppage time, with captain Ferjani Sassi heading a chance narrowly wide before a substitute guided a bobbling volley past the goal frame.
Clinching First Place
This result ensures that Nigeria, champions of the tournament on 3 past instances, move to 6 points and are assured first place in Group C with a match still to be contested.
In the next round, they will face a best third-place side from either the other preliminary groups.
In the other match, the 2004 champions remain on three group points, with Uganda and Tanzania locked on one point after playing out a 1-1 stalemate earlier on Saturday.
The final pool matches will see the group leaders remain in the city to play Uganda on the next matchday, while Tunisia travel back to Rabat to confront Tanzania.
An Anxious Finish
Ali Abdi drilled home from the penalty spot to offer Tunisia a glimmer of hope of snatching a draw.
The Super Eagles, finalists in the 2023 edition, are the second nation after Egypt to qualify for the knockout stage, but coach Eric Chelle and supporters will undoubtedly be breathing a sigh of relief.
What seemed set to be a straightforward last period transformed into a tense conclusion.
Victor Osimhen had a goal disallowed for an infringement before breaking the deadlock on the stroke of half-time, precisely placing a header into the far post from an Ademola Lookman delivery.
The advantage was doubled soon in the second half when the Leicester City midfielder climbed above everyone to power home a header from a Lookman kick.
Osimhen then turned provider his teammate for the seemingly decisive goal, before the defender to direct a header past the Nigerian shot-stopper to initiate the fightback.
The pivotal moment came when a looping cross hit the forearm of the full-back, with the official pointing to the spot after consulting the pitchside screen.
Despite Ali Abdi's confident conversion, the 2004 champions ultimately came up just short of pulling off a remarkable recovery.
Their fate remains in their control; a point against Tunisia will be enough to see them through, and their coach will be eager to prevent a recurrence of the 2013 early elimination that resulted in his previous resignation.