Imports rose 3.1pc to 209.4 billion Moroccan dirhams, outstripping exports of 124.8 billion dirhams, up 3.4pc.
Energy imports, including gas and oil, weighed on Morocco's trade balance with a rise of 2pc to 32.2 billion dirhams - representing 15.4pc of total imports.
Morocco has lifted subsidies on oil but controls the prices of cooking gas, sugar and wheat. The government's 2019 draft budget allocated 17.65 billion dirhams to the subsidies fund, up 4.65 billion dirhams from last year.
Sales in the automotive sector accounted for 27.6pc of Moroccan exports at 33.4 billion dirhams, up 0.3pc. The North African country is home to production plants of French carmakers Renault and car part suppliers.
French carmaker PSA last month opened a plant in Kenitra, near Rabat, which will initially produce 100,000 cars in 2020 before increasing to 200,000 by 2023, giving a much needed boost to exports in the effort to curb the trade deficit.
Exports of phosphates and byproducts including fertilisers climbed in the first five months this year by 7.8pc to a value of 20.8 billion dirhams.
Remittances from Moroccans living abroad dropped 3.4pc to 25.8 billion dirhams, while foreign direct investment fell by 16.7pc to 8.1 billion dirhams during the same period.