Ex- Continent's Best Player of the Year the Napoli star helped his team build a commanding lead, before they were forced to hold on for a narrow victory.
Nigeria survived a dramatic late rally from Tunisia to progress to the knockout stage of the Afcon tournament being held in the host nation.
The Super Eagles appeared to be in complete control in their Group C encounter in the Moroccan city, enjoying a 3-0 cushion with just 17 minutes left courtesy of strikes from their attacking trio.
However, Montassar Talbi reduced the deficit with a powerful header from a Hannibal Mejbri free-kick, igniting hopes of a recovery.
The tension escalated when Tunisia were given a late penalty after a video assistant referee check spotted a handball by the Nigerian defender. Ali Abdi calmly slotted home in the 87th minute to create a frantic finale.
Tunisia came agonizingly close from a last-gasp equalizer in added time, with their skipper heading a chance just past the post before Ismael Gharbi guided a half-volley past the upright.
The victory means that Nigeria, champions of the tournament on three previous occasions, move to six points and are assured top spot in Group C with a match still to play.
For the round of 16, they will meet a third-placed side from one of the other preliminary groups.
Meanwhile, Tunisia remain on 3 points, with Uganda and Tanzania locked on a single point after playing out a 1-1 stalemate in the day's other fixture.
The concluding group matches will see the group leaders stay in Fes to play the Cranes on the next matchday, while the Eagles of Carthage return to Rabat to face Tanzania.
The Tunisian defender drilled home from the penalty spot to give his team a glimmer of hope of snatching a point.
Nigeria, runners-up in the 2023 edition, are the next nation after the Pharaohs to qualify for the knockout stage, but their manager and fans will undoubtedly be feeling relieved.
What seemed set to be a straightforward final quarter morphed into a nerve-wracking conclusion.
Victor Osimhen had a effort disallowed for offside before breaking the deadlock on the stroke of half-time, precisely placing a header into the far post from an Ademola Lookman delivery.
The advantage was extended soon in the second half when Wilfred Ndidi rose highest to thump in a header from a set-piece kick.
Osimhen then set up his teammate for the third goal, only for Montassar Talbi to direct a header past the Nigerian shot-stopper to initiate the fightback.
The key incident came when a high ball hit the forearm of Bright Osayi-Samuel, with referee Boubou Traore pointing to the spot after consulting the VAR monitor.
Although the defender's successful penalty, Tunisia ultimately came up just short of completing a remarkable comeback.
Tunisia's destiny is still in their control; a point against Tunisia will be sufficient to secure progression, and manager Sami Trabelsi will be eager to avoid a recurrence of the past group-stage exit that resulted in his departure.
A seasoned gaming analyst with over a decade of experience in slot machine mechanics and player psychology, dedicated to sharing actionable insights.