Ex- African Footballer of the Year the Napoli star was instrumental in his team establish a 3-0 advantage, before they were compelled to defend resolutely for a narrow win.
Nigeria survived a stunning comeback attempt from their opponents to advance to the knockout stage of the 2025 Africa Cup of Nations taking place in the host nation.
Jose Peseiro's side appeared to be cruising in their pool clash in the Moroccan city, holding a 3-0 lead with only a quarter of an hour remaining thanks to goals from Victor Osimhen, Wilfred Ndidi and Ademola Lookman.
However, Montassar Talbi pulled one back with a close-range finish from a Hannibal Mejbri free-kick, sparking hopes of a turnaround.
The drama intensified when Tunisia were given a spot-kick after a VAR check spotted a handball by Bright Osayi-Samuel. Ali Abdi converted in the 87th minute to create a nail-biting conclusion.
Tunisia came agonizingly close from a last-gasp equalizer in added time, with captain Ferjani Sassi heading a opportunity narrowly wide before Ismael Gharbi guided a half-volley wide of the upright.
The victory ensures that Nigeria, winners of the tournament on three previous occasions, advance to six points and are assured first place in Group C with a match left to play.
In the next round, they will meet a best third-place side from one of Group A, B or F.
In the other match, the 2004 champions stay on three group points, with the East African teams locked on one point after registering a one-all draw earlier on Saturday.
The concluding group matches will see Nigeria stay in the city to play the Cranes on the next matchday, while Tunisia travel back to the capital to confront Tanzania.
Ali Abdi drilled the ball from the penalty spot to give Tunisia a glimmer of hope of snatching a point.
Nigeria, runners-up in the previous edition, become the second nation after Egypt to qualify for the knockout stage, but coach Eric Chelle and supporters will certainly be feeling relieved.
What looked like set to be a straightforward last period transformed into a nerve-wracking affair.
The prolific striker had a goal disallowed for offside before opening the scoring right before half-time, precisely placing a glancing effort into the bottom corner from an Atalanta winger cross.
The advantage was doubled early in the second period when the Leicester City midfielder rose highest to thump in a header from a set-piece corner.
Osimhen then turned provider his teammate for the seemingly decisive goal, only for Montassar Talbi to steer a header past the Nigerian shot-stopper to begin the comeback.
The key incident came when a high ball struck the arm of Bright Osayi-Samuel, with referee Boubou Traore awarding a penalty after consulting the pitchside screen.
Despite Ali Abdi's successful penalty, Tunisia ultimately came up just short of completing a remarkable recovery.
Tunisia's destiny is still in their control; a draw against Tanzania will be enough to see them through, and their coach will be keen 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 online casinos, specializing in slot machine mechanics and player psychology.