The evolution of sociality and altruism is enigmatic because cooperators are constantly threatened by cheaters who benefit from cooperation without incurring its full cost [1, 2]. Kin recognition is the ability to recognize and cooperate with genetically close relatives. It has also been proposed as a potential mechanism that limits cheating [3, 4], but there has been no direct experimental support for that possibility. Here we show that kin recognition protects cooperators against cheaters. The social amoebae Dictyostelium discoideum cooperate by forming multicellular aggregates that develop into fruiting bodies of viable spores and dead stalk cells. Cheaters preferentially differentiate into spores while their victims die as stalk cells in chimeric aggregates. We engineered syngeneic cheaters and victims that differed only in their kin-recognition genes, tgrB1 and tgrC1, and in a single cheater allele and found that the victims escaped exploitation by different types of nonkin cheaters. This protection depends on kin-recognition-mediated segregation because it is compromised when we disrupt strain segregation. These findings provide direct evidence for the role of kin recognition in cheater control and suggest a mechanism for the maintenance of stable cooperative systems.