Morocco have now qualified for their fifth World Cup (1970, 1986, 1994, 1998) and their first since France 1998.
Morocco has qualified for its first FIFA World Cup since 1998 after beating closest Group C challenger Ivory Coast 2-0 away from home on Sunday (AEDT), and Tunisia is through too after a 0-0 draw with Libya.
Unbeaten Tunisia collected 14 points to book a first World Cup appearance since 2006, DR Congo had 13, Libya four and Guinea three.
It will be Tunisia's first FIFA World Cup involvement since 2006 in Germany, and it joins Morocco, Egypt, Senegal and Nigeria as Africa's five representatives for Russian Federation 2018.
The North Africans finished top of the group on 12 points while Cote d'Ivoire occupied second position on eight.
Before Saturday, the trio of Nigeria, Egypt and Senegal had booked their tickets before the two North African countries also came on board to Russian Federation. Morocco needed just a point from the game to qualify but made sure.
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.
Florent Ibenge's side took the lead on 70 minutes through an own goal by Ousmane Sidibe.
Jonathan Bolingi's penalty and a goal from Fulham's Neeskens Kebano, both in injury time, gave the Leopards all three points and left them hoping for a Libya victor, but Tunisia held firm to seal their ticket to Russian Federation.
Jonathan Bolingi put the Congolese Lions ahead again two minutes into additional time and Neeskens Kebano added a third goal nearly immediately.