Former African Footballer of the Year Victor Osimhen helped his team build a commanding advantage, but they were forced to defend resolutely for a hard-fought victory.
Nigeria weathered a stunning comeback attempt from Tunisia to progress to the last 16 of the Afcon tournament taking place in the host nation.
Jose Peseiro's side appeared to be in complete control in their pool clash in the Moroccan city, holding a three-goal lead with just 17 minutes left thanks to goals from their attacking trio.
Yet, Montassar Talbi pulled one back with a powerful header from a Manchester United midfielder set-piece, igniting hopes of a recovery.
The tension intensified when Tunisia were awarded a late penalty after a video assistant referee check identified a handling offense by the Nigerian defender. Ali Abdi calmly slotted home in the 87th minute to create a nail-biting conclusion.
Tunisia came agonizingly close from a stunning equalizer in stoppage time, with their skipper directing a chance narrowly wide before a substitute sent a bobbling volley past the goal frame.
Securing Top Spot
This result ensures that Nigeria, champions of the tournament on 3 past instances, advance to six group points and are assured first place in their pool with a match left to be contested.
In the next round, they will face a third-placed team from one of Group A, B or F.
Meanwhile, the 2004 champions remain on 3 group points, with the East African teams locked on a single point after registering a 1-1 stalemate in the day's other fixture.
The concluding pool fixtures will see the group leaders stay in Fes to take on the Cranes on Tuesday, while Tunisia travel back to Rabat to confront Tanzania.
An Anxious Conclusion
The Tunisian defender drilled home from 12 yards to give Tunisia a glimmer of hope of earning a point.
Nigeria, finalists in the previous tournament, become the next team after Egypt to reach the next phase, but coach Eric Chelle and fans will certainly be breathing a sigh of relief.
What looked like set to be a comfortable final quarter transformed into a nerve-wracking affair.
Victor Osimhen had a goal ruled out for an infringement before breaking the deadlock on the stroke of the interval, precisely placing a header into the bottom corner from an Atalanta winger delivery.
The advantage was extended early in the second half when the Leicester City midfielder rose highest to power home a header from a Lookman corner.
The number 9 then set up Lookman for the seemingly decisive goal, before the defender to steer a header past goalkeeper Stanley Nwabali to initiate the fightback.
The pivotal moment arrived when a looping cross hit the forearm of Bright Osayi-Samuel, with referee Boubou Traore awarding a penalty after consulting the VAR monitor.
Despite Ali Abdi's confident conversion, Tunisia in the end came up just short of completing a stirring recovery.
Tunisia's destiny remains in their own hands; a draw against Tanzania will be enough to secure progression, and manager Sami Trabelsi will be eager to avoid a recurrence of the 2013 early elimination that resulted in his departure.