While social interactions play an important role for the evolution of bacterial siderophore production in vitro, the extent to which siderophore production is a social trait in natural populations is less clear. Here, we demonstrate that siderophores act as public goods in a natural physical environment of Pseudomonas fluorescens: soil-based compost. We show that monocultures of siderophore producers grow better than non-producers in soil, but non-producers can exploit others' siderophores, as shown by non-producers' ability to invade populations of producers when rare. Despite this rare advantage, non-producers were unable to outcompete producers, suggesting that producers and non-producers may stably coexist in soil. Such coexistence is predicted to arise from the spatial structure associated with soil, and this is supported by increased fitness of non-producers when grown in a shaken soil–water mix. Our results suggest that both producers and non-producers should be observed in soil, as has been observed in marine environments and in clinical populations.