Senegal reached Africa Cup of Nations final for the second time as Tunisia defender Dylan Bronn's extra-time own goal gave them victory.
Both sides had penalties saved in normal time before Bronn inadvertently headed the only goal of the game.
Mouez Hassen tipped Sadio Mane's free-kick on to Bronn's head as Senegal - who face Algeria in Friday's final - moved closer to a first Afcon title.
Tunisia had a late penalty award overturned by VAR.
After Salif Sane's headed clearance ricocheted off Idrissa Gueye's elbow, the referee initially pointed to the spot before overturning his decision after reviewing video footage.
Senegal dominated the first half, producing seven shots to Tunisia's two, with Mane spurning their best opportunity when he missed an open goal.
Tunisia improved after the interval and were awarded a penalty when Ferjani Sassi's effort struck Kalidou Koulibaly's arm, but Sassi's spot-kick lacked power and direction and was saved by Alfred Gomis.
Four minutes later Senegal were given a penalty of their own when Ismaila Sarr was brought down by Bronn, but Henri Saivet's shot was kept out by Hassen.
The Tunisia goalkeeper then inadvertently gifted victory to Senegal, who will be without influential captain Koulibaly for the final as he is suspended.
BBC Sport's Piers Edwards at the 30 June Stadium
This was an incredible Nations Cup semi-final - packed with incident, drama and decisions that will be debated for years.
Ultimately, Senegal got lucky after Hassen's appalling error enabled the Teranga Lions to lead through an own goal Bronn knew nothing about - then again when the penalty against Gueye late on was overturned by VAR. Any contact with a hand in the area often leads to a spot-kick these days, but Gueye was clearly trying to move his arm away from the ball.
By that stage, two penalties had been awarded and squandered - the second after a super save by Hassen (what a rollercoaster ride he has had) - but Senegal deserved to go through for their positivity. They constantly took the game to the Tunisians, who preferred to counter-attack after soaking up waves of attacks.
Concerns will be raised about Senegal's lack of creativity, with Sadio Mane notable for his anonymity - his Champions League campaign looks to have caught up with him, but credit must be given to Kalidou Koulibaly who, despite knowing he will miss the final after a harsh booking for the penalty, imperiously repelled Tunisia's frantic efforts to level late on.
What a game.