The Indomitable Lions took a one-point lead over Gabon into the final round of Group A fixtures and stretched it to four by full-time as their only rivals for a place at the 2010 finals in South Africa fell 1-0 away to Togo.
Achille Webo put Cameroon ahead on 18 minutes in Fes and three-time CAF African Footballer of the Year Samuel Eto'o added a second soon after half-time against a lacklustre Moroccan team.
Qualification was a personal triumph for French coach Paul Le Guen, who took over last August from German Otto Pfister with Cameroon bottom of the table having secured just one point from two outings.
Cameroon booked a passage to South Africa mere hours after Nigeria topped Group B by winning 3-2 in Kenya and they join South Africa, automatic qualifiers as hosts, Ghana and Côte d'Ivoire as the African Zone's representatives.
Egypt or Algeria, who meet later on Saturday in Cairo, will fill the remaining place.