Former African Footballer of the Year Victor Osimhen helped Nigeria establish a commanding advantage, before the Super Eagles were compelled to hold on for a hard-fought victory.
Nigeria survived a dramatic comeback attempt from Tunisia to progress to the last 16 of the Afcon tournament being held in the host nation.
The Super Eagles seemed to be cruising in their pool clash in Fes, enjoying a three-goal lead with only 17 minutes left courtesy of goals from Victor Osimhen, Wilfred Ndidi and Ademola Lookman.
Yet, a Tunisian defender pulled one back with a close-range finish from a Hannibal Mejbri set-piece, sparking hopes of a turnaround.
The drama escalated when Tunisia were given a late penalty after a VAR check spotted a handling offense by Bright Osayi-Samuel. The left-back calmly slotted home in the 87th minute to create a nail-biting conclusion.
Tunisia were inches away from a last-gasp equalizer in added time, with their skipper directing a opportunity just past the post before Ismael Gharbi sent a bobbling volley wide of the upright.
The victory means that the Super Eagles, winners of the competition on three past instances, advance to 6 group points and are assured first place in their pool with one game left to play.
For the round of 16, they will meet a best third-place side from either the other preliminary groups.
Meanwhile, Tunisia remain on 3 points, with the East African teams tied on one point after registering a 1-1 stalemate earlier on Saturday.
The concluding group fixtures will see Nigeria remain in the city to take on the Cranes on the next matchday, while Tunisia travel back to Rabat to confront the Taifa Stars.
Ali Abdi smashed home from 12 yards to give his team a glimmer of hope of earning 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 fans will undoubtedly be feeling relieved.
What looked like 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 on the stroke of the interval, expertly guiding a header into the far post from an Atalanta winger cross.
The lead was extended soon in the second half when Wilfred Ndidi rose highest to power home a powerful nod from a Lookman corner.
Osimhen then turned provider Lookman for the seemingly decisive goal, only for Montassar Talbi to direct a powerful header past goalkeeper Stanley Nwabali to initiate the comeback.
The key incident came when a high ball hit the forearm of Bright Osayi-Samuel, with referee Boubou Traore awarding a penalty after reviewing the pitchside screen.
Although the defender's confident conversion, Tunisia in the end came up just short of pulling off a stirring recovery.
Their fate is still in their control; a draw against Tunisia will be enough to see them through, and manager Sami Trabelsi will be eager to avoid a recurrence of the 2013 early elimination that led to his departure.
A tech strategist with over a decade of experience in digital innovation and AI-driven solutions, passionate about shaping the future of technology.