Former African Footballer of the Year Victor Osimhen was instrumental in his team establish a 3-0 lead, before the Super Eagles were compelled to hold on for a narrow win.
The three-time champions survived a stunning late rally from their opponents to advance to the knockout stage of the 2025 Africa Cup of Nations taking place in the host nation.
The Super Eagles seemed to be cruising in their Group C clash in Fes, holding a 3-0 cushion with just 17 minutes remaining courtesy of strikes from Victor Osimhen, Wilfred Ndidi and Ademola Lookman.
However, Montassar Talbi pulled one back with a powerful header from a Manchester United midfielder set-piece, sparking hopes of a turnaround.
The tension escalated when the North Africans were given a spot-kick after a video assistant referee check spotted a handling offense by the Nigerian defender. The left-back converted in the dying stages to set up a frantic conclusion.
Tunisia came agonizingly close from a stunning leveler in stoppage time, with captain Ferjani Sassi directing a chance narrowly wide before a substitute guided a bobbling volley wide of the upright.
This result ensures that Nigeria, champions of the tournament on three past instances, move to six points and are assured first place in their pool with one game left to play.
In the next round, they will meet a best third-place team from either Group A, B or F.
In the other match, Tunisia remain on 3 group points, with the East African teams tied on one point each after playing out a 1-1 draw in the day's other fixture.
The final group matches will see the group leaders stay in the city to take on the Cranes on the next matchday, while Tunisia travel back to Rabat to confront the Taifa Stars.
The Tunisian defender drilled home from 12 yards to offer his team hope of earning a point.
The Super Eagles, runners-up in the previous tournament, are the next team after the Pharaohs to qualify for the next phase, but their manager and supporters will undoubtedly be feeling relieved.
What looked like set to be a comfortable last period morphed into a tense affair.
Victor Osimhen had a goal ruled out for offside before breaking the deadlock right before the interval, precisely placing a header into the far post from an Ademola Lookman delivery.
The advantage was doubled early in the second half when the Leicester City midfielder climbed above everyone to power home a powerful nod from a set-piece kick.
Osimhen then set up his teammate for the seemingly decisive goal, only for the defender to steer a powerful header past the Nigerian shot-stopper to initiate the comeback.
The pivotal moment came when a looping cross struck the arm of the full-back, with the official awarding a penalty after consulting the VAR monitor.
Despite Ali Abdi's successful penalty, the 2004 champions in the end fell short of pulling off a stirring recovery.
Their fate is still in their own hands; a draw against Tunisia will be enough to see them through, and manager Sami Trabelsi will be eager to prevent a recurrence of the past early elimination that resulted in his departure.
A tech journalist and VR specialist with over a decade of experience covering emerging technologies and digital culture.