Youssef Msakni scored the goal to guarantee Tunisia’s progress
Tunisia reached their first Africa Cup of Nations semi-final since 2004 as they ended Madagascar’s fairytale run.
The Eagles of Carthage, who will face Senegal in Sunday’s last-four tie, led through Ferjani Sassi’s deflected shot from the edge of the box.
Youssef Msakni then doubled their lead after Wahbi Khazri’s shot was parried by Melvin Adrien.
Naim Sliti added an injury-time third to cap off a counter-attack as Madagascar sent players forward.
Indian Ocean island side Madagascar, ranked 108th in the world, were the story of their debut tournament. They had to start Afcon qualifying in the preliminary round in March 2017, but went on to stun Nigeria in the group stages last month and then DR Congo in the last 16.
Their squad contains players who play in Reunion, the French lower leagues and Thailand. Their head coach Nicolas Dupuis also manages French fourth-tier Fleury.
But their dream came to an end as they were well beaten by a professional Tunisia performance in Cairo.
Tunisia playmaker Khazri was heavily involved in proceedings throughout and had a free-kick tipped over the bar by Adrien. He then thought he had scored their opener, but it was disallowed correctly for offside.
Tunisia got the breakthrough when Sassi’s shot hit the backside of Thomas Fontaine and flew into the net. And the game was over once Msakni scored.
The underdogs, who never looked like scoring, took risks in a bid to find a way back into the game – and Khazri squared the ball for Sliti to finish off a quick break and seal the win.
They face Senegal at 17:00 BST on Sunday, with Algeria facing Nigeria at 20:00 BST.
‘Madagascar’s wonderful but impossible fairytale ends’ – analysis
Pierre-Antione Denis at the Al-Salam Stadium, Cairo
It was simply too much effort for Madagascar against a Tunisian side that, despite not being impressive, secured a spot for the semi-finals.
The Carthage Eagles were never really threatened and had all the time they needed to settle into their game. It really seemed like they only had to increase their tempo for 20 minutes to bring this home.
Ferjani Sassi was really impressive in dictating the tempo of the game, breaking the defensive lines with his long passes. His numerous efforts to help breaking the deep defensive lines were greeted with a goal.
The Bareas made everybody dream of a wonderful yet ultimately impossible fairytale. But they certainly leave Egypt showing the continent that anything is possible with hard work and ambition.
BBC Sport Africa