They'll join Nigeria, Egypt and Senegal as the continent's five representatives at next year's tournament in Russian Federation.
The qualification of Morocco and Tunisia signaled an apparent shift in African soccer, giving North Africa three teams at the World Cup and more than any other region for the first time since 1986.
Morocco, who completed their qualifying campaign with maximum points and no goals conceded, last appeared in a World Cup in 1998 in France. Senegal qualified for the World Cup for the first time since 2002 on Friday after defeating South Africa 2-0. But it was the Moroccans who got the breakthrough when Nabil Dirar's cross evaded everyone and found its way it to the net.
A goalless stalemate at home to Libya was enough for the Eagles of Carthage to pip Congo DR to top spot in Group A, while Morocco recorded an impressive 2-0 victory away to Côte d'Ivoire.
The Atlas Lions then doubled their lead just five minutes later through captain Mehdi Benatia's neat finish off a corner, ensuring Herve Renard's men finished top of Group C.
Tunisia finished on 14 points in Group A of the African preliminaries, one ahead of the Democratic Republic of Congo, who fell short despite a 3-1 win over Guinea in Kinshasa at the same time. The Tunisians held on for the draw, though, and it turned out to be a precious point.
Immediately after Morocco's national team secured it qualification to the 2018 World Cup in Russia, Moroccans of NY flocked to Steinway street in Astoria to celebrate this victory.