The public goods game is a famous example illustrating the tragedy of the commons. In this game cooperating individuals contribute to a pool, which in turn is distributed to all members of the group, including defectors who reap the same rewards as cooperators without having made a contribution before. The question is now, how to incentivize group members to all cooperate as it maximizes the common good. While costly punishment presents one such method, the cost of punishment still reduces the common good. Here we show how group-level selection can be such an incentive, and specifically how even fractions of group-level selection can overcome the benefits defectors receive. Further, we show how punishment and group-level selection interact. This work suggests that a redistribution similar to a basic income that is coupled to the economic success of the entire group could overcome the tragedy of the commons.