Morocco sealed its place by winning 2-0 in Cote d'Ivoire in what was a straight shootout for the place from Group C.
Morocco returns to the world's biggest stage for the first time since 1998.
The North Africans finished top of the group on 12 points while Cote d'Ivoire occupied second position on eight.
While the Elephants will be left to rue a first World Cup qualifying failure since 2002, Morocco can now look forward to heading to Russian Federation as North Africa's third representatives alongside Tunisia and Egypt.
DR Congo were the only team still with a chance to catch Tunisia, but they fell short despite a late 3-1 win over Guinea.
While Tunisia held on to a 0-0 draw against Libya to make their first World Cup appearance since 2006.
UAE condemns attack on Bahrain oil pipeline
The UAE on Saturday condemned the terrorist explosion and expressed its solidarity with the kingdom. . An oil pipeline exploded in Bahrain on Friday, causing a massive fire near a market and a hospital.
Tunisia and Morocco completed CAF's line up at the FIFA World Cup™, securing the last of Africa's berths at Russian Federation 2018.
Ivory Coast had the first chance at a packed 35,000-seat Stade Felix Houphouet-Boigny but veteran Gervinho blazed over with only the goalkeeper to beat from inside the box.
"Therefore you have to play without sparing yourself in order to win it...but defeat never crossed my mind" Renard who coached the Ivorians to the 2015 title of the African Nations Cup in Equatorial Guinea said.
The first blow came when an intended cross from Dirar went over an Ivorian defender and a Moroccan attacker and slipped past goalkeeper Sylvain Gbohouo into the far corner.
But Morocco comfortably contained the hosts in a match that threatened to boil over at times with Dirar and Crystal Palace flyer Wilfried Zaha wrestling each other to the ground. Before today's matches, Tunisia had 13 points while DR Congo had 10 points.