Shallow coastal bays with dense aquatic phytobenthic communities are important but vulnerable habitats and nursery areas for fish and invertebrates in the Baltic Sea. These habitats are under increasing anthropogenic stress, and understanding their dynamics is a prerequisite for management and conservation. In this study, we examined the effects of isolation of the bay from the sea, water and sediment characteristics, and macrophyte species on the invertebrate communities. In each bay, both epifauna and infauna were sampled in pairs of monospecific patches of dominating habitat-forming macrophytes (Stuckenia pectinata, Chara tomentosa and Ceratophyllum demersum). We found that the invertebrate community was mainly affected by bay isolation, which correlated with other environmental variables, and thus likely drives many processes in the bays. Further, the epifauna community responded to both the median grainsize and geometric standard deviation across both the isolation gradient (S. pectinata alone) and in the S. pectinata - C. demersum macrophyte pair, whereas the median grainsize affected the epifauna in the S. pectinata - C. tomentosa macrophyte pair. The infauna community responded to either the median grainsize or the geometric standard deviation across the isolation gradient and in both macrophyte pairs. Only minor differences between the dominating macrophyte species were seen regarding invertebrate abundance, taxon richness and diversity, although the more structurally complex C. demersum supported the highest epifauna diversity and lowest infauna abundance. However, at local, within bay scale, epifauna communities varied between most pairs of macrophyte species, suggesting that habitat-forming macrophytes have important roles in structuring local invertebrate community patterns. This study emphasizes the complexity of biotic and abiotic interactions within and among shallow coastal bays, and the challenges with studying and comparing processes in these unique ecosystems.