Former African Footballer of the Year Victor Osimhen helped his team establish a 3-0 advantage, before the Super Eagles were compelled to defend resolutely for a narrow win.
Nigeria survived a dramatic late rally from their opponents to progress to the last 16 of the Afcon tournament taking place in Morocco.
Jose Peseiro's side seemed to be in complete control in their Group C clash in Fes, enjoying a 3-0 lead with only 17 minutes remaining thanks to goals from their attacking trio.
However, Montassar Talbi pulled one back with a powerful header from a Manchester United midfielder free-kick, igniting hopes of a turnaround.
The tension intensified when the North Africans were awarded a spot-kick after a video assistant referee review identified a handling offense by Bright Osayi-Samuel. The left-back calmly slotted home in the dying stages to create a frantic conclusion.
Tunisia were inches away from a last-gasp equalizer in added time, with captain Ferjani Sassi heading a chance just past the post before a substitute sent a half-volley past the upright.
Clinching First Place
The victory ensures that the Super Eagles, winners of the tournament on three previous occasions, move to six points and are guaranteed 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, the 2004 champions stay on three points, with Uganda and Tanzania locked on a single point each after playing out a one-all stalemate earlier on Saturday.
The concluding group matches will see Nigeria remain in the city to play the Cranes on Tuesday, while the Eagles of Carthage return to Rabat to confront the Taifa Stars.
A Nervy Conclusion
Ali Abdi drilled the ball from the penalty spot to offer Tunisia hope of earning a point.
Nigeria, finalists in the previous edition, are the next nation after the Pharaohs to reach the knockout stage, but their manager and supporters will certainly be feeling relieved.
What seemed set to be a comfortable final quarter transformed into a nerve-wracking conclusion.
The prolific striker had a effort disallowed for offside before opening the scoring right before the interval, precisely placing a glancing effort into the bottom corner from an Ademola Lookman cross.
The lead was doubled soon in the second half when Wilfred Ndidi rose highest to power home a powerful nod from a Lookman kick.
The number 9 then turned provider his teammate for the third goal, before Montassar Talbi to direct a header past the Nigerian shot-stopper to initiate the comeback.
The pivotal incident arrived when a looping cross hit the forearm of the full-back, with the official awarding a penalty after reviewing the pitchside screen.
Although the defender's confident conversion, the 2004 champions in the end came up just short of pulling off a stirring recovery.
Tunisia's destiny remains in their own hands; a draw against Tanzania will be sufficient to see them through, and their coach will be keen to prevent a repeat of the 2013 group-stage exit that resulted in his departure.