Ex- Continent's Best Player of the Year Victor Osimhen helped Nigeria build a commanding lead, but they were forced to hold on for a narrow victory.
The three-time champions weathered a stunning comeback attempt from their opponents to advance to the last 16 of the Afcon tournament taking place in Morocco.
The Super Eagles seemed to be cruising in their pool encounter in Fes, enjoying a three-goal cushion with only a quarter of an hour left thanks to strikes from their attacking trio.
However, a Tunisian defender pulled one back with a powerful header from a Hannibal Mejbri set-piece, igniting hopes of a turnaround.
The drama intensified when the North Africans were given a late penalty after a VAR review spotted a handling offense by Bright Osayi-Samuel. Ali Abdi calmly slotted home in the 87th minute to create a frantic finale.
Tunisia were inches away from a stunning equalizer in stoppage time, with their skipper directing a opportunity just past the post before Ismael Gharbi sent a bobbling volley past the upright.
Clinching First Place
This result means that Nigeria, champions of the competition on three previous occasions, advance to six group points and are assured top spot in their pool with one game left to play.
For the round of 16, they will meet a best third-place side from one of the other preliminary groups.
Meanwhile, the 2004 champions remain on 3 points, with Uganda and Tanzania tied on one point after registering a 1-1 draw in the day's other fixture.
The final group fixtures will see the group leaders stay in the city to play Uganda on the next matchday, while the Eagles of Carthage return to the capital to confront the Taifa Stars.
A Nervy Finish
The Tunisian defender drilled home from 12 yards to offer Tunisia hope of snatching a point.
The Super Eagles, runners-up in the 2023 tournament, become the next team after Egypt to qualify for the next phase, but coach Eric Chelle and fans will certainly be feeling relieved.
What seemed set to be a comfortable last period morphed into a nerve-wracking affair.
Victor Osimhen had a effort disallowed for an infringement before opening the scoring on the stroke of the interval, expertly guiding a glancing effort into the far post from an Ademola Lookman delivery.
The lead was doubled soon in the second half when Wilfred Ndidi rose highest to power home a powerful nod from a set-piece kick.
The number 9 then turned provider his teammate for the third goal, only for the defender to steer a header past goalkeeper Stanley Nwabali to begin the comeback.
The key moment arrived when a looping cross hit the forearm of Bright Osayi-Samuel, with the official pointing to the spot after consulting the pitchside screen.
Although the defender's successful penalty, the 2004 champions ultimately came up just short of pulling off a stirring comeback.
Tunisia's destiny is still in their own hands; a draw against Tanzania will be enough to see them through, and their coach will be eager to avoid a recurrence of the past early elimination that resulted in his previous resignation.