Boufal hammered home from close range after a mazy run into the penalty area from Zakaria Aboukhlal that saw him tease the Ghana defence, only to be checked by Thomas Partey, with the ball then running perfectly for Boufal to score.
- Africa Cup of Nations bracket and fixtures schedule
- Africa Cup of Nations: Everything you need to know
- AFCON kit rankings: Who has the best jersey?
- Don't have ESPN? Get instant access
The goal came from a rare chance in a game where both sides showed defensive prowess but did little to impress in attack.
Both countries are looking to end a long wait for success in the continental championship but showed little early sign of making an impact at the tournament in Cameroon, admittedly after disrupted preparations.
Boufal's goal did open up a cagey affair and Morocco had two more decent chances as captain Romain Saiss headed wide after an 87th minute free kick and then in stoppage time Ghana's keeper Joe Wollacott stopped a blistering shot from close range.
Until then, there had only been two opportunities for Ghana.
Joseph Paintsil hit a goal-bound shot towards the top corner in the 70th minute only for Morocco goalkeeper Yassine Bounou to turn the effort around the post.
Ghana also had a good set-piece opportunity in the 31st minute but Partey fired his free kick over the bar.
The victory extended to 10 matches Morocco's winning streak, including all six World Cup qualifiers played between September and November.
Morocco won their only Cup of Nations title in 1976 while Ghana are four-time African champions -- the last time in 1982.
Morocco next play Comoros on Friday followed by Ghana against Gabon in the late game.