The Mediterranean Sea is warming faster than the global ocean, with important consequences for organisms and biogeochemical cycles.Warming is a major stressor for key marine benthic macrophytes. However, the effect of warming on marine N fixation remains unknown, despite the fact that the high productivity of macrophytes in oligotrophic waters is partially sustained by the input of new nitrogen (N) into the system by N fixation. Here, we assess the impact of warming on the N fixation rates of three key marine macrophytes: Posidonia oceanica, Cymodocea nodosa, and Caulerpa prolifera. We experimentally measured N fixation rates in vegetated and bare sediments at temperatures encompassing current summer mean (25 and 27 °C), projected summer mean (29 and 31 °C), and projected summer maximum (33 °C) seawater surface temperatures (SSTs) by the end of the century under a scenario of moderate greenhouse gas emissions. We found that N fixation rates in vegetated sediments were 2.8-fold higher than in bare sediments at current summer mean SST, with no differences among macrophytes. Currently, the contribution of N fixation to macrophyte productivity could account for up to 7 %, 13.8 %, and 1.8% of N requirements for P. oceanica, C. nodosa, and C. prolifera, respectively.We show the temperature dependence of sediment N fixation rates. However, the thermal response differed for vegetated sediments, in which rates showed an optimum at 31 °C followed by a sharp decrease at 33 °C, and bare sediments, in which rates increased along the range of the experimental temperatures. The activation energy and Q10 were lower in vegetated than bare sediments, indicating the lower thermal sensitivity of vegetated sediments. The projected warming is expected to increase the contribution of N fixation to Mediterranean macrophyte productivity. Therefore, the thermal dependence of N fixation might have important consequences for primary production in coastal ecosystems in the context of warming.