Former African Footballer of the Year the Napoli star was instrumental in his team establish a commanding lead, before they were compelled to hold on for a hard-fought victory.
Nigeria survived a dramatic comeback attempt from Tunisia to advance to the last 16 of the Afcon tournament being held in the host nation.
The Super Eagles appeared to be in complete control in their pool clash in the Moroccan city, holding a three-goal cushion with just a quarter of an hour left thanks to goals from Victor Osimhen, Wilfred Ndidi and Ademola Lookman.
Yet, Montassar Talbi reduced the deficit with a close-range finish from a Manchester United midfielder set-piece, igniting hopes of a turnaround.
The tension intensified when Tunisia were awarded a late penalty after a VAR check identified a handling offense by Bright Osayi-Samuel. The left-back converted in the dying stages to create a frantic conclusion.
The Carthage Eagles came agonizingly close from a last-gasp leveler in stoppage time, with captain Ferjani Sassi directing a opportunity just past the post before a substitute sent a half-volley wide of the upright.
Clinching Top Spot
This result means that Nigeria, winners of the competition on 3 previous occasions, move to 6 group points and are guaranteed top spot in their pool with a match still to play.
In the next round, they will face a third-placed side from either Group A, B or F.
In the other match, Tunisia remain on three group points, with Uganda and Tanzania tied on a single point after playing out a 1-1 stalemate in the day's other fixture.
The final pool matches will see Nigeria remain in Fes to play the Cranes on the next matchday, while the Eagles of Carthage return to Rabat to face Tanzania.
A Nervy Finish
Ali Abdi smashed home from 12 yards to offer his team a glimmer of hope of earning a draw.
Nigeria, finalists in the 2023 edition, become the second nation after the Pharaohs to qualify for the next phase, but their manager and supporters will undoubtedly be breathing a sigh of relief.
What looked like set to be a comfortable final quarter transformed into a nerve-wracking affair.
The prolific striker had a goal ruled out for an infringement before opening the scoring on the stroke of the interval, expertly guiding a glancing effort into the bottom corner from an Atalanta winger delivery.
The lead was extended early in the second period when Wilfred Ndidi rose highest to thump in a powerful nod from a set-piece corner.
The number 9 then turned provider Lookman for the seemingly decisive goal, only for Montassar Talbi to steer a header past the Nigerian shot-stopper to begin the fightback.
The key moment came when a high ball hit the arm of Bright Osayi-Samuel, with referee Boubou Traore pointing to the spot after reviewing the VAR monitor.
Despite Ali Abdi's successful penalty, Tunisia ultimately fell short of completing a remarkable recovery.
Tunisia's destiny remains in their control; a draw against Tanzania will be enough to see them through, and manager Sami Trabelsi will be eager to prevent a recurrence of the past early elimination that led to his previous resignation.