The Super Eagles were cruising to victory when leading 3-0 through goals from Victor Osimhen, captain Wilfred Ndidi and Ademola Lookman.
But Tunisia refused to surrender in the top-of-the-table Group C clash and Montassar Talbi and Ali Abdi scored to set up a tense finish.
Tunisia had two chances to level during seven minutes of added time, but a header from captain Ferjani Sassi and a shot by substitute Ismael Gharbi were just off target.
Nigeria have six points, Tunisia three and Tanzania and Uganda one each with the final round of group matches set for Tuesday.
The showdown was the seventh time the Super Eagles and the Carthage Eagles had faced each other at an AFCON.
Nigeria won three times and Tunisia once. Another two meetings went to penalty shootouts with each nation winning one.
After performing well below par when edging Tanzania in the opening round, Nigeria were a transformed team against Tunisia, dominating the first 30 minutes in the northern city.
Osimhen was outstanding, particularly in aerial duels, while Tunisia were forced to constantly defend against the three-time champions.
The Galatasaray striker, wearing his trademark mask, headed just over after nine minutes and came close again soon after as he rose to meet a corner kick.
Osimhen had the ball in the net after 17 minutes, but was rightly ruled offside. Big-screen replays showed the 2023 African player of the year timing his run too early. ref: AFP