Atlas Lions' goals were scored by Amine Harit (45th+2), Ayoub El Kaabi (59th) and Amine Adli (89th).
Thanks to this victory, Morocco finished top of its group with 9 points, ahead of South Africa (7 pts) and Liberia (1 pt).
The Moroccan squad officially clinched, last March, its ticket for 2023 AFCON in Côte d’Ivoire, where it is housed in Group F with DR Congo, Tanzania and Zambia.