Striker Issam Jemaa came off the bench to score a last minute winner and put Tunisia on the brink of the African Nations Cup quarter-finals after a 2-1 victory over Niger on Friday.
Jemaa, an injury doubt before the start of the tournament, won it on the stroke of fulltime after cutting inside two defenders to power the ball home from close range. It gave Tunisia a second Group C win after a 2-1 success over Morocco in their opener.
Debutants Niger, who had shown a marked improvement from the side overwhelmed 2-0 by co-hosts Gabon in their first game on Monday, cannot now reach the last eight.
The first two goals came in the opening seven minutes but chances flowed freely thereafter.
The opener was sublime move and finish, the second bordered on the bizarre.
Tunisia's left winger Youssef Msakni dribbled his way past four defenders before placing the ball past the left-hand side of goalkeeper Daouda Kassaly after four minutes.
Niger were soon level when a long clearance into the Tunisia penalty area dropped with some awkward back spin, fooling keeper Aymen Mathlouthi who was distracted at the same time by an attempt from Moussa Maazou to slap the ball. It bounced onto the head of William Tonji Ngounou, who steered into an empty net.
Msakni missed with two chances soon after while at the other end Maazou wrought havoc in the Tunisia defense with his burly frame. His power and pace saw him twice glide past the defense but go agonizingly wide.
Both sides hit the woodwork before Jemaa's goal. Tunisia might have made it 3-1 deep in stoppage time when Oussama Darragi hit the underside of the bar but the ball bounced back into play.
Gabon and Morocco were due to meet later in Libreville in the second match of the day.