Ayoub el Kaabi broke brave resistance from the Mauritanians on 66 minutes and Ismail el Haddad added a second goal six minutes later at Stade Mohamed V in Casablanca.
Morocco started with three of 2017 CAF Champions League-winning Wydad Casablanca team, but only brought on star attackers Achraf Bencharki and Walid el Karti in the closing stages.
Victory for the hosts brought a cheerful end to a sad day for Moroccan football with former star Hamid Hazzaz dying of a heart attack aged 72 just hours before the tournament began.
Known as "The Spider", Hazzaz was part of the Morocco 1970 World Cup squad and the team that won the Africa Cup of Nations for the only time six years later.
A colourful opening ceremony preceded the first match and 14-year-old crown prince Moulay el Hassan got the tournament under way with a symbolic kick-off.
The young royal also shook hands with each player and the match officials and posed for team pictures with the Moroccans and Mauritanians.
Staged every two years, the Nations Championship is restricted to home-based footballers and the Democratic Republic of Congo (twice), Tunisia and Libya won previous editions.
In other Sunday fixtures, the Ivory Coast play debutants Namibia and Zambia face Uganda in Group B in Marrakech.