Younes Belhanda and Hakim Ziyech scored in the first half to ensure Morocco continued to show good form.
The country finished their World Cup preparations with a confidence-building 3-1 away win over Estonia in a friendly international on Saturday.
Belhanda scored after 11 minutes and Dutch-born Ziyech added a penalty seven minutes before the break.
Substitute Youssef En-Nesyri added a third with 15 minutes to go but Estonia pulled one back through Ats Purje.
Morocco beat Slovakia on Monday and drew with Ukraine last week in their other two warm-up games.
They meet Iran in their Group B opener in St Petersburg on Friday before also taking on Portugal and Spain.