Tunisia booked a semifinal berth against Senegal at the Africa Cup of Nations tournament, after edging out a stubborn Madagascar 2-0 on Thursday night.
The two sides played out a drab first half that was void of any real action, as they went into the break still tied at 0-0.
The match, however, erupted to life in the second half, with the North African side taking the lead three minutes after the restart, but Khazri's goal was ruled out for offside.
They, however, took the lead seven minutes in a cruel way for Madagascar, after Ferjani Sassi's shot took a huge deflection and sneaked past Thomas Fontaine.
Things got a lot worse for Madagascar nine minutes later, as Youssef Msakni scored the second for the Eagles to put them in a comfortable position going into the last half hour.
Madagascar, who were appearing for the first time in the continental showpiece, could not mount a comeback, as the Tunisians ensured they denied them possession.
There was little action in the remaining minutes of the match, but there was enough time for Tunisia to add a third late on in the dying minutes of the match, as Naim Sliti scored in the 94th minute after a lightning counter-attack.
There was no time for further action, and the referee blew his whistle with the North African side booking a semifinal date against Senegal.
In the other semifinal match, Algeria, who squeezed past Ivory Coast will face the Super Eagles of Nigeria.