When group interests clash with individual ones, maintaining cooperation poses a problem. However, cooperation can be facilitated by introducing reputational incentives. Through indirect reciprocity, people who cooperate in a social dilemma are more likely to receive cooperative acts from others. Another mechanism that enhances group cooperation is reputation-based partner choice, or competitive altruism. According to this framework, cooperators benefit via increased access to cooperative partners. Our study compared the effectiveness of indirect reciprocity and competitive altruism in re-establishing cooperation after the typical decline found during repeated public goods games. Twenty groups of four participants first played a series of public goods games, which confirmed the expected decline. Subsequently, public goods games were alternated with either indirect reciprocity games (in which participants had an opportunity to give to another individual from whom they would never receive a direct return) or competitive altruism games (in which they could choose partners for directly reciprocal interactions). We found that public goods game contributions increased when interspersed with competitive altruism games; they were also higher than in public goods games interspersed with indirect reciprocity games. Investing in reputation by increasing contributions to public goods was a profitable strategy in that it increased returns in subsequent competitive altruism and indirect reciprocity games. There was also some evidence that these returns were greater under competitive altruism than indirect reciprocity. Our findings indicate that strategic reputation building through competitive altruism provides an effective alternative to indirect reciprocity as a means for restoring cooperation in social dilemmas.