A 2-0 win over Ivory Coast helped send Boufal and his national side through, with only a draw needed to secure qualification.
The Southampton man will be therefore have the opportunity to represent his country next year at the World Cup finals in Russia, in what would be his first major tournament with the side.
With Boufal on the subs bench, Morocco went 1-0 up just before the half-hour mark, with Nabil Dirar putting the away side ahead.
The team’s captain, Juventus defender Medhi Benatia, put the game to bed with 15 minutes of the first half left to play. Playmaker Mbark Boussoufa’s corner was met by the 30-year-old, who finished cleverly.
The win means that the Moroccan national side have now gone seven games without defeat, and are currently on a run of three straight victories to finish out the year.
The home side fielded a strong side that included Tottenham’s right-back Serge Aurier and former Arsenal man Gervinho, but they could still only muster one shot on target.
More from Saints Marching
- Grading the Southampton Transfer Window Part 2: Arrivals
- Grading the Southampton Transfer Window Part 1: Departures
- It’s time to talk about Gavin Bazunu
- Rain clouds on the horizon? Southampton beat Plymouth Argyle
- A lament for Southampton legend James Ward-Prowse
Marc Wilmots’ side were dominant in possession with nearly 60 percent of the ball, but it wasn’t utilized and the African nation will miss out the World Cup as a result. It marks the first time in 15 years that the side haven’t qualified for the tournament.
Meanwhile it’ll be the first time since 1998 in which the Morroccan’s have reached the World Cup finals, having only progressed past the group stage on one occasion.
Boufal, who was originally born in France, has been a full international since last year, winning five caps along the way.