A 68th-minute goal from Achraf Bencharki gave Wydad a 1-0 win over 10-man Zanaco of Zambia before a near-capacity crowd in an 80,000-seat Casablanca stadium.
After his first attempt was blocked by goalkeeper Toaster Nsabata, Bencharki pounced on the rebound, turned and fired a low shot into the net.
Wydad topped Group D with 12 points, one more than record eight-time African champions Ahly and Zanaco while Coton Sport of Cameroon finished pointless after six straight losses.
Ahly and Zanaco had identical head-to-head records after battling to goalless draws in Alexandria and Lusaka.
Goal difference was the second tie-breaker and Ahly finished plus-four after coming from behind to defeat Coton 3-1 while Zanaco were only plus two.
It was the first Champions League loss suffered by Zanaco this season and only the third goal they conceded after four wins and five draws in qualifying and group matches.
Ahly, who began their match against Coton knowing only a win would take them through to the knockout stage for the first time since 2013, suffered an early setback.
They fell behind at the 90,000-capacity Borg El Arab Stadium in Mediterranean city Alexandria after 12 minutes when veteran defender Ahmed Fathy conceded an own-goal.
Amr Gamal came to the rescue by equalising soon after and he also scored the third Ahly goal on 54 minutes after Abdallah El Said gave the Cairo club a 2-1 half-time lead.
Esperance and Etoile Sahel of Tunisia are the other north African qualifiers for the quarter-finals.
The total could swell to six Sunday with USM Alger of Algeria and Zamalek of Egypt the likeliest clubs to advance from Group B.
There will also be at least two quarter-finalists from southern Africa -- defending champions Mamelodi Sundowns of South Africa and Ferroviario Beira of Mozambique.