Tunisia boosted their chances of reaching the Africa Cup of Nations quarter-finals with a 2-1 win over neighbours Algeria.
They took the lead when Algeria’s Aissa Mandi directed Youssef Msakni’s left-wing cross into his own net.
And some dreadful defending by Faouzi Ghoulam led to him bringing down Wahbi Khazri for a penalty which Naim Sliti coolly slotted into the right corner.
Algeria pulled a goal back when Sofiane Hanni struck from the edge of the area.
Tunisia’s victory takes them to three points and second place in Group B and leaves Algeria with only one point.
Group leaders Senegal can qualify later on Thursday by beating Zimbabwe.
It means Algeria, who had been one of the pre-tournament favourites, will have to rely on other results going their way if they are to qualify from the group – and they have to face Senegal in their final match.
Tunisia went into the game off the back of a 2-0 defeat to Senegal and anything other than victory against Algeria would have left them in serious trouble.
They were fortunate with their first goal, the ball looping off Mandi’s foot to deceive Algerian goalkeeper Malik Asselah, who was playing in place of injured first-choice stopper Rais M’bolhi.
And they were gifted their second when Algeria defender Ghoulam sent an underpowered header back towards his goal and then fouled Khazri who had nipped ahead of him to collect the ball and bear down on goal. Sliti confidently struck home the spot-kick.
Algeria started the match well and Islam Slimani’s point-blank header brought an excellent save from Aymen Mathlouthi, while Riyad Mahrez should have done better with a shot from the edge of the area.
Much of Tunisia’s best work involved Kazri – starting for the first time at the tournament – and the Sunderland midfielder tested Asselah early on with a free-kick.
Algeria struggled to rouse themselves after going behind and although substitute Hanni took his chance well, sending a curling shot into the corner, their largely toothless display has left them on the verge of an early exit.