Issam Jemaa's 90th-minute winner put former champion Tunisia into the African Cup of Nations quarterfinals on Friday with a hard-fought 2-1 victory over tournament debutant Niger.

The substitute stepped inside two defenders and hammered a left-footed shot into the net to finally shake off Niger's rousing challenge in the Group C game at Stade de l'Amitie.

Youssef Msakni's second goal in two games put Tunisia ahead in the fourth minute and apparently on course for a straightforward victory, only for Ngounou Tonji to equalize five minutes later.

Niger then had the Tunisians rattled, hitting the post and missing good chances through center forward Moussa Maazou before a shaky Tunisia found its composure in the second half.

Niger's rally after falling behind to an early goal against one of the continent's top teams nearly kept alive its slim hopes of progressing at its first tournament. Tunisia's nerves finally settled, however, with Jemaa's late strike to seal a second straight win.

''We gave our opponents many chances but we tried to make the most of the chances that came our way,'' Tunisia coach Sami Trabelsi said. ''Thank god we were able to win.''

Msakni put the Tunisians in front with a weaving run and finish reminiscent of his goal in the opening win over Morocco, skipping away from defenders and slipping his shot neatly past Kassaly Daouda.

It suggested Tunisia would breeze past the group underdog, but that wasn't the case.

The lead lasted five minutes before Niger scored its first goal at a major tournament, with Tonji's header greeted with joy on the bench by players and coach Harouna Doula.

Maazou challenged goalkeeper Aymen Mathlouthi in the air with the striker flapping at the ball with his hand, but there seemed to be no contact and Tonji followed up to head into an empty net. Niger's historic goal stood, despite strong protests from the 'keeper and teammates.

''Niger has a lot of progress to make,''assistant coach Rolland Courbis said, ''but maybe that progress has started today. I'm very proud of that.''

Maazou also had a great chance to complete a shock turnaround in the 18th but he shot wide after shrugging off a challenge from Tunisia captain Karim Haggui. He again powered away from Haggui in the 30th before pushing a right-footed shot past the far post.

Niger right winger Issoufou Boubacar's low effort three minutes later struck the same post after a touch from Mathlouthi, with Tunisia on the ropes and hanging on.

Tunisia boss Trabelsi looked on with arms crossed and his team would have been relieved to reach halftime without further damage against the suddenly rampant debutants. Niger's players, as has become their tradition at the tournament, knelt in a huddle to pray at the end of the half.

Jemaa was brought on at the break and the experienced forward appeared to settle Tunisia.

Daouda was off his line quickly in the 57th to scramble a through ball away with Jemaa closing in, and Msakni curled a shot just wide soon after.

In the 64th, defender Aymen Abdennour - who had taken over the marking duties of the troublesome Maazou - surged forward and sent a low shot from way out off the same post that Niger had struck.

Almost immediately, Niger booted upfield to Maazou, who forced his way past the last defender but couldn't beat Mathlouthi.

Tunisia's Ammar Jemal headed over with Daouda out of position and the goal gaping in the 89th. He sank to his knees and screamed at himself in frustration with the North Africans appearing to have slipped up.

But Jemaa latched onto a pass on the right of the penalty area in the dying minutes, coolly cut inside the scrambling Niger defenders and finished convincingly.

---

AP Sports Writer Gerald Imray reported from Franceville, Gabon.