Morocco opened the scoring in the fourth minute as Steven Vitoria left a ball for Canadian keeper Milan Borjan and a miscommunication led to Hakim Ziyech stealing the ball and scoring into an empty net.
Morocco earned a corner in the ninth minute but Borjan made his first save of the game as he punched the ball away out of danger. Morocco doubled their lead 14 minutes later as Youssef En-Nesyri beat Vitoria and Kamal Miller and powered a shot past Borjan.
Canada got on the scoreboard in the 40th minute as Sam Adekugbe went to cross the ball across the face of the goal and the ball deflected off Nayef Aguerd the Moroccan defender and into the net.
On the ensuing corner, Canada seemed to gain momentum and had another great cross but it was punched away by the keeper Yassine Bounou.
The first half finished with Morocco up 2-1 and 45 minutes away from a potential spot in the knockout stage.
Belgiumโs campaign at the Qatar World Cup ended in heartbreak as they bowed out of the group stages of the tournament with a frustrating goalless draw against Croatia at the Ahmad bin Ali Stadium on Thursday.
Belgium finished third in their group behind Morocco and Croatia.