Ex- Continent's Best Player of the Year Victor Osimhen helped his team establish a 3-0 lead, before the Super Eagles were compelled to defend resolutely for a hard-fought victory.
Nigeria survived a stunning late rally from Tunisia to progress to the last 16 of the Afcon tournament taking place in the host nation.
The Super Eagles appeared to be in complete control in their Group C encounter in Fes, holding a three-goal cushion with only a quarter of an hour left thanks to goals from their attacking trio.
However, a Tunisian defender pulled one back with a powerful header from a Manchester United midfielder free-kick, sparking hopes of a turnaround.
The drama intensified when the North Africans were awarded a spot-kick after a VAR review identified a handball by Bright Osayi-Samuel. Ali Abdi converted in the dying stages to create a nail-biting conclusion.
The Carthage Eagles came agonizingly close from a last-gasp equalizer in added time, with their skipper heading a chance narrowly wide before a substitute guided a half-volley wide of the goal frame.
The victory ensures that the Super Eagles, winners of the competition on 3 previous occasions, move to six group points and are guaranteed top spot in Group C with a match still to be contested.
In the next round, they will meet a third-placed side from either Group A, B or F.
Meanwhile, the 2004 champions remain on three points, with the East African teams tied on a single point each after playing out a one-all stalemate earlier on Saturday.
The final group matches will see the group leaders remain in the city to take on Uganda on Tuesday, while the Eagles of Carthage return to the capital to confront Tanzania.
The Tunisian defender smashed the ball from the penalty spot to offer Tunisia a glimmer of hope of earning a draw.
Nigeria, runners-up in the previous edition, are the next team after Egypt to reach the next phase, but their manager and fans will undoubtedly be breathing a sigh of relief.
What seemed set to be a comfortable final quarter transformed into a tense conclusion.
The prolific striker had a effort disallowed for offside before opening the scoring right before the interval, expertly guiding a header into the far post from an Atalanta winger cross.
The lead was doubled early in the second period when Wilfred Ndidi rose highest to thump in a header from a set-piece corner.
Osimhen then turned provider Lookman for the seemingly decisive goal, before the defender to direct a header past the Nigerian shot-stopper to initiate the fightback.
The key incident arrived when a high ball hit the forearm of Bright Osayi-Samuel, with the official awarding a penalty after consulting the pitchside screen.
Despite Ali Abdi's successful penalty, the 2004 champions in the end came up just short of pulling off a stirring recovery.
Tunisia's destiny remains in their own hands; a point against Tunisia will be enough to see them through, and manager Sami Trabelsi will be keen to avoid a repeat of the 2013 early elimination that led to his departure.
A seasoned gaming analyst with over a decade of experience in online casinos, specializing in slot machine reviews and player strategy optimization.