Net ecosystem productivity (NEP) of seasonally dry grasslands in Mediterranean climate zones is determined by the duration and intensity of rainy vs. dry seasons. Precipitation in these zones is expected to decline with climate change during the next century, possibly reducing NEP. Ecosystem models used to study climate change impacts on grasslands in these zones need first to simulate effects of soil wetting and drying on the duration and intensity of net C uptake and emission during rainy and dry seasons under current climate. Continuous eddy covariance (EC) measurements of CO2 and energy exchange provide well constrained tests of such models. In this study, hourly CO2 and energy exchange from the ecosystem model ecosys were tested against EC measurements recorded over an annual grassland at Vaira Ranch, CA in a Mediterranean climate zone during eight years (2001–2008) with variable rainy seasons. Variation in measured CO2 and latent heat fluxes was sufficiently well simulated during each year of the study (0.7 < R2 < 0.9) that most of the variation unexplained by the model could be attributed to uncertainty in the measurements. Interannual variation in NEP from the model was also correlated with that from EC measurements (R2 = 0.75). Annual NEP from both the model and EC were correlated with the duration of net C uptake, but not with the amount of precipitation, during the rainy seasons. Average annual NEP of the grassland modelled from 2001 to 2008 was 29 g C m−2 y−1 with an interannual variation of ±110 g C m−2 y−1 caused by that in the duration of net C uptake. During climate change (SRES A1fi and B1 under HadCM3), changes in modelled NEP were determined by changes in duration and intensity of net C uptake in rainy seasons vs. net C emission in dry seasons. In years with briefer rainy seasons, modelled NEP rose because rates of net C uptake increased with higher temperature and CO2concentration, while the duration of net C uptake remained limited by that of the rainy season. However in years with longer rainy seasons, modelled NEP declined because the duration of net C uptake was reduced when warming hastened phenological development and caused maturity of annual plants to be reached before the end of the rainy season. As climate change progressed, declines in annual NEP gradually exceeded rises, causing the small C sink modelled under current climate to be almost completely lost after 90 years under SRES A1fi (2 ± 103 g C m−2 y−1) and B1 (6 ± 95 g C m−2 y−1).