Morocco secured its victory with Zakaria Ouahdi netting the winning goal in the 73rd minute.
The teams are set to face off again next Monday in a second friendly match, both serving as crucial preparation for the Paris 2024 Olympic tournament for the reigning African champions.
In the Tokyo 2020 Games, it was the Brazilian selection that clinched the gold medal in the Olympic tournament.