Tunisia were held to a goalless home draw by a resolute Libya side on Saturday but they were able to secure a World Cup spot for the first time since 2006.
The Carthage Eagles, who finished with 14 points, just needed a draw to beat off competition from group challengers DR Congo who defeated Guinea 3-1 to remain second with 13 points.
The hosts were very cautious and did not seem to be taking any risks against Libya, who kept pushing forward until the final whistle as Tunisia celebrated with the home crowd in jubilant scenes at the end.
Tunisian president Beji Caid Essebsi attended the match at Rades Stadium.
Tunisia have reached the World Cup finals for the first time in 12 years, having made their last appearance in 2006 in Germany.
This is the fifth time Tunisia reach the World Cup after1978, 1998, 2002 and 2006. They never managed to get past the first round though.
Morocco became the fifth African team to secure a spot in Russia 2018 after defeating Ivory Coast 2-0 to seal their place in Russia.