Given their documented capacity to track changes in environmental conditions and human alterations, benthic diatom communities are at present widely used in biomonitoring programs to evaluate stream water quality. However, it is becoming more and more evident that species ecological preferences are not the only drivers of diatom community composition, since dispersal-related processes also play a role. This is particularly compelling in Alpine streams, where orographic conformation and humanrelated impacts limit dispersal of organisms. In addition, several environmental variables may influence diatom community in pristine or impacted sites. We here investigate the differential role of environmental and spatial factors in driving the community assemblages of diatoms in streams of the Eastern Italian Alps, focusing on both taxonomic and functional composition. We analysed data from 110 samples collected on two different geological substrates, i.e. calcareous and siliceous, during the last eight years of biomonitoring programs, among which 64 collected in reference sites and 46 in impacted sites. We first evaluated whether diatom communities in reference and impacted sites are differentially shaped by environmental and spatial factors, highlighting the major role of spatial constraints in both of them. In particular, anthropogenic disruption of longitudinal connectivity in streams likely shaped impacted communities, as demonstrated by the increasing abundance of motile 2 taxa, which are associated with physical disturbance. Conversely, reference communities were mostly affected by spatially structured environmental variables, especially those related to streambed lithology. We then compared the taxonomic and functional composition of diatom communities between the two geological substrates in both reference and impacted sites to better highlight the differential role of this factor. Our results demonstrate that lithology strongly drives diatom community composition in reference but not in impacted sites, confirming our previous observations. The analysis of functional traits, however, highlighted how differences were due not only to the geological substrates, but also to other environmental variables, like flow velocity. Overall, the effect of the spatial component on the structure of diatom assemblages can represent a background noise in the framework of the river quality assessment, and this should be taken into account especially in those countries, like Italy, covering a broad range of mountain areas.