Summary1. Biodiversity–environment relationships are increasingly well‐understood in the context of species richness and species composition, whereas other aspects of biodiversity, including variability in functional diversity (FD), have received rather little rigorous attention. For streams, most studies to date have examined either taxonomic assemblage patterns or have experimentally addressed the importance of species richness for ecosystem functioning.2. I examined the relationships of the functional biodiversity of stream macroinvertebrates to major environmental and spatial gradients across 111 boreal headwater streams in Finland. Functional biodiversity encompassed functional richness (FR – the number of functional groups derived from a combination of functional feeding groups and habit trait groups), FD – the number of functional groups and division of individuals among these groups, and functional evenness (FE – the division of individuals among functional groups). Furthermore, functional structure (FS) comprised the composition and abundance of functional groups at each site.3. FR increased with increasing pH, with additional variation related to moss cover, total nitrogen, water colour and substratum particle size. FD similarly increased with increasing pH and decreased with increasing canopy cover. FE decreased with increasing canopy cover and water colour. Significant variation in FS was attributable to pH, stream width, moss cover, substratum particle size, nitrogen, water colour with the dominant pattern in FS being related to the increase of shredder‐sprawlers and the decrease of scraper‐swimmers in acidic conditions.4. In regression analysis and redundancy analysis, variation in functional biodiversity was not only related to local environmental factors, but a considerable proportion of variability was also attributable to spatial patterning of environmental variables and pure spatial gradients. For FR, 23.4% was related to pure environmental effects, 15.0% to shared environmental and spatial effects and 8.0% to spatial trends. For FD, 13.8% was attributable to environmental effects, 15.2% to shared environmental and spatial effects and 5% to spatial trends. For FE, 9.0% was related to environmental variables, 12.7% to shared effects of environmental and spatial variables and 4.5% to spatial variables. For FS, 13.5% was related to environmental effects, 16.9% to shared environmental and spatial effects and 15.4% to spatial trends.5. Given that functional biodiversity should portray variability in ecosystem functioning, one might expect to find functionally rather differing ecosystems at the opposite ends of major environmental gradients (e.g. acidity, stream size). However, the degree to which variation in the functional biodiversity of stream macroinvertebrates truly portrays variability in ecosystem functioning is difficult to judge because species traits, such as feeding roles and habit traits, are themselves strongly affected by the habitat template.6. If functional characteristics show strong responses to natural environmental gradients, they also are likely to do so to anthropogenic environmental changes, including changes in habitat structure, organic inputs and acidifying elements. However, given the considerable degree of spatial structure in functional biodiversity, one should not expect that only the local environment and anthropogenic changes therein are responsible for this variability. Rather, the spatial context, as well as natural variability along environmental gradients, should also be explicitly considered in applied research.