Local adaptation is commonly observed in nature: organisms perform well in their natal environment, but poorly outside it. Correlations between traits and latitude, or latitudinal clines, are among the most common pieces of evidence for local adaptation, but identifying the traits under selection and the selective agents is challenging. Here, we investigated a latitudinal cline in growth and photosynthesis across 16 populations of the perennial herb Erythranthe cardinalis (Phrymaceae). Using machine learning methods, we identify interannual variation in precipitation as a likely selective agent: southern populations from more variable environments had higher photosynthetic rates and grew faster. We hypothesize that selection may favour a more annualized life history – grow now rather than save for next year – in environments where severe droughts occur more often. Thus, our study provides insight into how species may adapt if Mediterranean climates become more variable due to climate change.