Morocco got off the mark early, with Hakim Ziyech capitalizing on a poor clearance by Canada goalkeeper Milan Borjan, chipping the ball into a gaping net to make it 1-0.
Striker Yussef En-Nesyri doubled Morocco's lead when he got on the end of a lofted through ball, powering an attempt past the near post.
Canada pulled one back when Moroccan defender Nayef Aguerd deflected Sam Adekugbe's cross past his own keeper to make the score 2-1 just before half-time.
En-Nesyri thought he extended the lead once again with a cool volley that went in off the post, but the linesman flag went up to signal offside, and the goal was disallowed.
Head coach John Herdman subbed on Atiba Hutchinson, Jonathan David, Ismaël Koné and Richie Laryea to ramp up the pressure on Morocco, who surrendered the majority of possession to Canada in the second half.
Hutchinson came millimetres from equalized when his header off a corner bounced off the crossbar, down onto the goal-line before going out of play.
In the end, it wasn't meant to be for the Canadians, as Morocco's resilient defense turned back Canada's advances to hold on to the 2-1 win and booking their ticket to the knockout stage.
Canada shuffled the deck for their World Cup finale against Morocco on Thursday.
Captain Atiba Hutchinson along with Jonathan David and Richie Laryea were removed from the starting 11, while midfielder Stephen Estaquio is unavailable due to injury. Jonathan Osorio, Sam Adekugbe and Mark-Anthony Kaye drew in to start the match.
— Canada Soccer (@CanadaSoccerEN) December 1, 2022
Follow along for live updates:
Start time: 10:00 a.m. ET
TV channel: CTV and TSN
How to stream: TSN.ca
Canada was drawn into Group F with second-ranked Belgium, 12th-ranked Croatia and 22nd-ranked Morocco. Canada, currently ranked 41st, lost 2-1 to Belgium in their opener and 4-1 to Croatia on Sunday.
Davies is Canada's best player and is a legitimate superstar on the world stage. David is making a name for himself playing for Lille in France's top domestic league. Other names who could make an impact include Stephen Eustáquio, Tajon Buchanan, and Cyle Larin.
You can find the full roster here.
More from Yahoo Sports