Ex- Continent's Best Player of the Year Victor Osimhen helped his team establish a 3-0 advantage, before they were compelled to defend resolutely for a hard-fought win.
Nigeria survived a stunning late rally from their opponents to advance to the knockout stage of the 2025 Africa Cup of Nations taking place in Morocco.
Jose Peseiro's side appeared to be cruising in their pool clash in Fes, holding a 3-0 cushion with only a quarter of an hour remaining courtesy of goals from Victor Osimhen, Wilfred Ndidi and Ademola Lookman.
Yet, Montassar Talbi pulled one back with a close-range finish from a Hannibal Mejbri set-piece, igniting hopes of a turnaround.
The tension escalated when the North Africans were given a late penalty after a video assistant referee check identified a handling offense by the Nigerian defender. The left-back converted in the dying stages to create a nail-biting conclusion.
The Carthage Eagles came agonizingly close from a stunning leveler in stoppage time, with captain Ferjani Sassi directing a chance narrowly wide before Ismael Gharbi guided a bobbling volley past the upright.
Securing First Place
This result means that Nigeria, winners of the tournament on 3 past instances, move to six points and are assured top spot in their pool with a match still to be contested.
For the round of 16, they will face a third-placed team from one of Group A, B or F.
Meanwhile, Tunisia remain on three group points, with the East African teams tied on a single point after playing out a one-all stalemate earlier on Saturday.
The concluding pool fixtures will see Nigeria stay in the city to play the Cranes on the next matchday, while Tunisia travel back to the capital to confront Tanzania.
An Anxious Finish
Ali Abdi smashed the ball from 12 yards to give Tunisia a glimmer of hope of snatching a draw.
The Super Eagles, finalists in the 2023 edition, are the next team after the Pharaohs to qualify for the next phase, but their manager and supporters will undoubtedly be feeling relieved.
What seemed set to be a straightforward final quarter transformed into a nerve-wracking conclusion.
Victor Osimhen had a effort disallowed for an infringement before breaking the deadlock on the stroke of the interval, expertly guiding a glancing effort into the far post from an Atalanta winger delivery.
The advantage was extended soon in the second period when the Leicester City midfielder climbed above everyone to power home a powerful nod from a set-piece corner.
The number 9 then set up Lookman for the seemingly decisive goal, only for Montassar Talbi to direct a powerful header past the Nigerian shot-stopper to initiate the comeback.
The pivotal moment came when a high ball struck the forearm of Bright Osayi-Samuel, with referee Boubou Traore awarding a penalty after consulting the pitchside screen.
Despite the defender's confident conversion, the 2004 champions ultimately came up just short of pulling off a stirring recovery.
Their fate is still in their own hands; a point against Tunisia will be sufficient to see them through, and manager Sami Trabelsi will be keen to prevent a repeat of the 2013 group-stage exit that resulted in his previous resignation.