Tunisia gave themselves an African Nations Cup lifeline and put northern neighbours Algeria on the brink of elimination with a 2-1 win in Franceville.
An Aissa Mandi own goal early in the second half and a Naim Sliti penalty after 66 minutes put Tunisia in control before Sofiane Hanni pulled a goal back in stoppage time but it was too little too late for Algeria, who are already reliant on results elsewhere if they are to progress from Group B.
The result leaves Tunisia with three points from two games, with Algeria having picked up just one point so far in a group that also contains Senegal and Zimbabwe.
It was an end-to-end start to the game with chances for both teams. Yacine Brahimi's free kick was helped over the crossbar by Aymen Mathlouthi, who then made a superb instinctive save to keep out Islam Slimani's header from the resulting corner.
Malik Asselah, in goal for Tunisia ahead of the injured Rais M'Bolhi who has a knee problem, pushed away a Wahbi Khazri free-kick, while back at the other end Mathlouthi fisted away Adlene Guedioura's swerving long-range effort.
Algeria had a huge let off after 21 minutes when Khazri's low corner flew across the face of goal before almost being turned in at full stretch at the far post by Ahmed Akaichi.
Leicester duo Slimani and Riyad Mahrez combined shortly afterwards but Mathlouthi was down to his right quickly to get a strong hand behind the shot, which was slightly scuffed by Mahrez.
The tempo dipped thereafter but the match came to life again five minutes into the second half when Tunisia took the lead. Ferjani Sassi lifted the ball into the path of Youssef Msakni down the left-hand side and his low cross deflected off Mandi and past the goalkeeper at his near post.
Tunisia doubled their advantage when Msakni's ball over the top brought a mistake from Faouzi Ghoulam, allowing Khazri in on goal. Ghoulam clipped the attacker's heels and Sliti tucked away the penalty.
Algeria had a glimmer of hope when Hanni brilliantly finished Guedioura's cut back into the roof of the net but they could not find an equaliser in the remaining four minutes of stoppage time.