Former Continent's Best Player of the Year Victor Osimhen helped his team build a 3-0 advantage, before they were compelled to defend resolutely for a hard-fought victory.
The three-time champions survived a dramatic late rally from their opponents to progress to the knockout stage of the 2025 Africa Cup of Nations taking place in Morocco.
Jose Peseiro's side seemed to be in complete control in their pool encounter in the Moroccan city, enjoying a 3-0 lead with just 17 minutes remaining thanks to goals from their attacking trio.
Yet, a Tunisian defender reduced the deficit with a close-range finish from a Manchester United midfielder set-piece, igniting hopes of a turnaround.
The drama escalated when Tunisia were awarded a spot-kick after a VAR check spotted a handling offense by the Nigerian defender. Ali Abdi calmly slotted home in the dying stages to create a frantic finale.
Tunisia came agonizingly close from a last-gasp equalizer in stoppage time, with their skipper directing a chance just past the post before Ismael Gharbi sent a half-volley past the goal frame.
This result means that Nigeria, winners of the competition on 3 past instances, move 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 face a best third-place team from one of Group A, B or F.
In the other match, Tunisia stay on three group points, with Uganda and Tanzania tied on one point after playing out a one-all stalemate in the day's other fixture.
The final group matches will see Nigeria stay in Fes to take on the Cranes on the next matchday, while Tunisia return to Rabat to face the Taifa Stars.
The Tunisian defender drilled the ball from 12 yards to give Tunisia hope of earning a draw.
Nigeria, finalists in the 2023 edition, are the next team after the Pharaohs to reach the next phase, but their manager and supporters will undoubtedly be feeling relieved.
What looked like set to be a straightforward last period morphed into a tense affair.
The prolific striker had a effort ruled out for an infringement before breaking the deadlock on the stroke of the interval, expertly guiding a header into the bottom corner from an Atalanta winger cross.
The lead was extended soon in the second half when the Leicester City midfielder rose highest to power home a powerful nod from a set-piece corner.
The number 9 then set up Lookman for the seemingly decisive goal, before the defender to direct a header past the Nigerian shot-stopper to begin the comeback.
The key moment arrived when a looping cross struck the arm of the full-back, with referee Boubou Traore pointing to the spot after consulting the pitchside screen.
Despite Ali Abdi's successful penalty, Tunisia in the end fell short of completing a remarkable recovery.
Their fate remains in their control; a point against Tanzania will be sufficient to secure progression, and their coach will be eager to prevent a repeat of the past group-stage exit that resulted in his previous resignation.
A tech-savvy writer and AI enthusiast who explores how digital tools transform personal expression and productivity.