The widespread existence of cooperation is difficult to explain because individuals face strong incentives to exploit the cooperative tendencies of others. In the research reported here, we examined how the spread of reputational information through gossip promotes cooperation in mixed-motive settings. Results showed that individuals readily communicated reputational information about others, and recipients used this information to selectively interact with cooperative individuals and ostracize those who had behaved selfishly, which enabled group members to contribute to the public good with reduced threat of exploitation. Additionally, ostracized individuals responded to exclusion by subsequently cooperating at levels comparable to those who were not ostracized. These results suggest that the spread of reputational information through gossip can mitigate egoistic behavior by facilitating partner selection, thereby helping to solve the problem of cooperation even in noniterated interactions.