Match ends, Tunisia 1, Equatorial Guinea 2.
Equatorial Guinea beat Tunisia in controversial circumstances to reach the Africa Cup of Nations semi-finals.
Ahmed Akaichi looked to have put Tunisia into the last four when he turned in Hamza Mathlouthi's cross.
The hosts, ranked 96 places below their opponents, sent it to extra time when Javier Balboa netted an injury-time penalty after Ali Maaloul was harshly ruled to have fouled Ivan Bolado.
And Balboa scored the winner with a fantastic free-kick from 25 yards.
Equatorial Guinea will face Ghana or Guinea in their first Cup of Nations semi-final on Thursday.
The game ended with ugly scenes as both sets of officials and players clashed in the 120th minute, with security getting involved, and at the final whistle some Equatorial Guinea fans ran onto the pitch to celebrate a famous win.
Bottles were thrown at Tunisia players, with one Carthage Eagles player throwing one back.
The minnows, ranked 118th in the world, only entered the tournament in November when they replaced Morocco as hosts because of the Ebola crisis.
They had been eliminated from qualifying after fielding an ineligible player, only hired coach Esteban Becker 11 days before the tournament and gave five players debuts in a pre-tournament friendly.
However they qualified from Group A thanks to victory over Gabon in their final game to reach their second quarter-final. They lost the first - in the 2012 event they co-hosted - to Ivory Coast.
Tunisia, meanwhile, topped a group with DR Congo, Cape Verde and Zambia and had good reason to enter the game in confident mood.
It was a game of few chances, with Akaichi having a shot touched over by Felipe Ovono before he opened the scoring.
Emilio Nsue was denied a leveller with eight minutes left by Tunisia keeper Aymen Mathlouthi, setting up the incredible late drama.
Bolado dribbled into the area and appeared to stand on the edge of Maaloul's foot before falling to the floor. The referee awarded a penalty in front of a partisan home crowd to a furious reaction from the Tunisian bench.
Some fans shone lasers in the eyes of Tunisia keeper Mathlouthi, who went the wrong way as Balboa rolled it into the net.
In extra time, the momentum was with Equatorial Guinea and Balboa curled home a wonderful free-kick in the first period.
Tunisia created few chances to force penalties before the match ended on a sour note with chaos in the Bata Stadium.
- 20Ali YacoubiBooked at 63minsSubstituted forMsakniat 104'minutes
- 2S Ben Youssef
- 6RaguedBooked at 9mins
- 13SassiBooked at 90mins
- 18KhazriSubstituted forAli Moncerat 85'minutes
- 19AkaichiBooked at 66minsSubstituted forChermitiat 85'minutesBooked at 86mins
- 1Ben Mustapha
- 15Ali Moncer
- 22Ben Cherifia
- 23Ben Djemia
- 8Iyanga TraviesoSubstituted forBoladoat 80'minutes
- 5Mbele Mangue
- 4Da Gracia Gomes
- 16Bohale AqueriacoSubstituted forBelimaat 86'minutes
- 21Zarandona Esono
- 11Balboa Osa
- 9Fabiani BosioSubstituted forEdúat 61'minutesBooked at 90mins
- 2Vazquez Evuy
- 3Engonga Noval
- 6Edjogo-Owono Montalbán
- 13Embela Gil
- 17Obama Nsue Ondo
- Rajindraparsad Seechurn
- Shots on Target
Second Half Extra Time ends, Tunisia 1, Equatorial Guinea 2.
Foul by Syam Ben Youssef (Tunisia).
Iván Zarandona (Equatorial Guinea) wins a free kick in the defensive half.
Corner, Tunisia. Conceded by Diosdado Mbele.
Attempt blocked. Youssef Msakni (Tunisia) right footed shot from the centre of the box is blocked.
Attempt blocked. Youssef Msakni (Tunisia) right footed shot from the centre of the box is blocked. Assisted by Ferjani Sassi with a headed pass.
Hand ball by Ali Maâloul (Tunisia).
Attempt saved. Ferjani Sassi (Tunisia) header from the centre of the box is saved in the bottom right corner. Assisted by Aymen Abdennour.
Foul by Yassine Chikhaoui (Tunisia).
Rubén Belima (Equatorial Guinea) wins a free kick in the defensive half.
Delay over. They are ready to continue.
Delay in match Felipe Ovono (Equatorial Guinea) because of an injury.
Offside, Tunisia. Ali Maâloul tries a through ball, but Hocine Ragued is caught offside.
Attempt saved. Ali Maâloul (Tunisia) left footed shot from outside the box is saved in the bottom right corner.
Youssef Msakni (Tunisia) wins a free kick in the attacking half.
Foul by Iván Bolado (Equatorial Guinea).
Syam Ben Youssef (Tunisia) wins a free kick in the defensive half.
Foul by Emilio Nsue Lopez (Equatorial Guinea).
Foul by Mohamed Ali Moncer (Tunisia).