Animals can benefit from classifying predators or other dangers into categories, tailoring their escape strategies to the type and nature of the risk. Studies of alarm vocalizations have revealed various levels of sophistication in classification 1, 2, 3, 4, 5. In many taxa, reactions to danger are inflexible, but some species can learn the level of threat presented by the local population of a predator 6, 7, 8 or by specific, recognizable individuals 9, 10. Some species distinguish several species of predator, giving differentiated warning calls and escape reactions; here, we explore an animal's classification of subgroups within a species. We show that elephants distinguish at least two Kenyan ethnic groups and can identify them by olfactory and color cues independently. In the Amboseli ecosystem, Kenya, young Maasai men demonstrate virility by spearing elephants (Loxodonta africana), but Kamba agriculturalists pose little threat. Elephants showed greater fear when they detected the scent of garments previously worn by Maasai than by Kamba men, and they reacted aggressively to the color associated with Maasai. Elephants are therefore able to classify members of a single species into subgroups that pose different degrees of danger.