Contemporary climate change is characterized both by increasing mean temperature and increasing climate variability such as heat waves, storms, and floods. How populations and communities cope with such climatic extremes is a question central to contemporary ecology and biodiversity conservation. Previous work has shown that species diversity can affect ecosystem functioning and resilience. Here, we show that genotypic diversity can replace the role of species diversity in a species-poor coastal ecosystem, and it may buffer against extreme climatic events. In a manipulative field experiment, increasing the genotypic diversity of the cosmopolitan seagrass Zostera marina enhanced biomass production, plant density, and faunal abundance, despite near-lethal water temperatures due to extreme warming across Europe. Net biodiversity effects were explained by genotypic complementarity rather than by selection of particularly robust genotypes. Positive effects on invertebrate fauna suggest that genetic diversity has second-order effects reaching higher trophic levels. Our results highlight the importance of maintaining genetic as well as species diversity to enhance ecosystem resilience in a world of increasing uncertainty.