The North Africans had a late chance to snatch victory and survive, but substitute Haythem Jouini headed a cross well over the crossbar.
Tunisia became the second top 10-ranked nation after Algeria to be eliminated after the opening round. Mali won Group E after a 0-0 draw with Namibia, and both qualified for the knockout stage along with second-placed South Africa.
Read more AFCON: The full fixtures and tables Tunisia dropped veteran captain and forward Youssef Msakni after he made little impact in a loss to Namibia and draw with Mali.
Defender Yassine Meriah took over as skipper. After a four-goal hammering of Namibia, South Africa retained the same starting line-up, which included eight players from Mamelodi Sundowns, the dominant domestic club.