Primary production correlates with diversity in various ways. These patterns may result from the interaction of various mechanisms related to the environmental context and the spatial and temporal scale of analysis. However, empirical evidence on diversity-productivity patterns typically considers single temporal and spatial scales, and does not include the effect of environmental variables. In a metacommunity of macrophytes in ephemeral ponds, we analysed the diversity-productivity relationship patterns in the field, the importance of the environmental variables of pond size and heterogeneity on such relationship, and the variation of these patterns at local (community level) and landscape scales (metacommunity level) across 52 ponds on twelve occasions, over five years (2005–2009). Combining all sampling dates, there were 377 ponds and 1954 sample-unit observations. Vegetation biomass was used as a proxy for productivity, and biodiversity was represented by species richness, evenness, and their interaction. Environmental variables comprised pond area, depth and internal heterogeneity. Productivity and species richness were not directly related at the metacommunity level, and were positively related at the community level. Taking environmental variables into account revealed positive species richness-productivity relationships at the metacommunity level and positive quadratic relationships at the community level. Productivity showed both positive and negative linear and nonlinear relationships with the size and heterogeneity of ponds. We found a weak relationship between productivity and evenness. The identity of variables associated with productivity changed between spatial scales and through time. The pattern of relationships between productivity and diversity depends on spatial scale and environmental context, and changes idiosyncratically through time within the same ecosystem. Thus, the diversity-productivity relationship is not only a property of the study system, but also a consequence of environmental variations and the temporal and spatial scale of analysis.