The assemblage structure and spatial distribution patterns of macrobenthic communities according to environmental conditions were analysed through five samplings carried out at 14 intertidal soft sediment stations in the Oualidia lagoon (NW Morocco). A total of 89 macrobenthic taxa were collected, amounting to 55.188 specimens. Molluscs, polychaetes and arthropods were the most species‐rich groups. The snail Peringia ulvae was the most dominant species, especially abundant in the mid‐ and upper lagoon sections (nearly 64% of the total specimens gathered), followed by the mollusc Scrobicularia plana (10%). Diversity values were generally low (<3 bit) pointing out the high dominance by few species. Multivariate analyses clearly distinguished three distinct macrobenthic assemblages, successively distributed from lagoon inlets towards inner parts. Nevertheless, each assemblage was found in particular habitat types and had a specific species composition in response to different environmental characteristics. (a) The Scolelepis fuliginosa community occupied sandy substrates at the lower section of the lagoon with stronger marine influence and, (b) the P. ulvae community lived in sandy‐muddy substrates, including two sub‐communities dominated, respectively, by Cerastoderma edule, S. plana and Tritia pfeffeiri inhabiting the middle section and S. plana the upper section. The combination of salinity, temperature, pH and silt content was identified as the major environmental variable subset with the highest correlation with the observed macrofaunal patterns and silt fraction as the single best correlated variable. The results demonstrated significant spatial differences in macrobenthic assemblage structure and composition along environmental gradients in spite of the absence of direct freshwater river inflow.