A common strategy among microbes living in iron-limited environments is the secretion of siderophores, which can bind poorly soluble iron and make it available to cells via active transport mechanisms. Such siderophore-iron complexes can be thought of as public goods that can be exploited by local communities and drive diversification, for example by the evolution of "cheating." However, it is unclear whether bacterial populations in the environment form stable enough communities such that social interactions significantly impact evolutionary dynamics. Here we show that public good games drive the evolution of iron acquisition strategies in wild populations of marine bacteria. We found that within nonclonal but ecologically cohesive genotypic clusters of closely related Vibrionaceae, only an intermediate percentage of genotypes are able to produce siderophores. Nonproducers within these clusters exhibited selective loss of siderophore biosynthetic pathways, whereas siderophore transport mechanisms were retained, suggesting that these nonproducers can act as cheaters that benefit from siderophore producers in their local environment. In support of this hypothesis, these nonproducers in iron-limited media suffer a significant decrease in growth, which can be alleviated by siderophores, presumably owing to the retention of transport mechanisms. Moreover, using ecological data of resource partitioning, we found that cheating coevolves with the ecological specialization toward association with larger particles in the water column, suggesting that these can harbor stable enough communities for dependencies among organisms to evolve.