Morocco collected four points after two rounds and a draw would be enough for them to book a berth in the next phase, while Canada had been eliminated following back-to-back defeats against Belgium and Croatia.
The Atlas Lions pressed high from the start, trying to use their aggression and tempo to good effect. It paid off just four minutes into the game when Canada defender Steven Vitoria's wayward pass forced goalkeeper Milan Borjan to clear the ball cheaply, and Morocco's Hakim Ziyech followed to send the ball into an empty net from distance.
Morocco doubled their lead in the 23rd minute when a long ball over the top found Youssef En Nesyri who outpaced two defenders to slot home.
The Canadians pulled one goal back in the 40th minute as Nayef Aguerd accidentally prodded Sam Adekugbe's pass into his net, scoring the first own goal of the Qatar World Cup.
En Nesyri thought he had scored his second before the break, but it was flagged offside.
Morocco were a little complacent and error-prone in the second half, allowing Canada to create a couple of chances. Atiba Hutchinson was close to scoring an equalizer but the veteran saw his header hit the goal-line after bouncing off the bar.
In a bid to avoid three consecutive defeats, Canada poured forward in the dying minutes and even Borjan rushed into the opposites' box, but they were still toothless to turn the game around.