We examined patterns of affiliation within groups of sperm whales (Physeter macrocephalus), particularly concentrating on how short-term spatio–temporal associations reflect long-term relationships. Female and immature sperm whales live in stable, and partially matrilineal, social units. Two or more social units may move together for periods of several days, forming a cohesive group of about 20 animals. We observed that sperm whales in the eastern tropical Pacific quite consistently associated with members of their own social unit more than they did with other animals in their group with whom they did not share a long-term relationship. There was little evidence for preferred, or avoided, affiliations within social units, except in two large and relatively unstable units. In two well-studied groups, individuals did not show consistently favoured positions in the foraging rank relative to other members of their social unit. These results indicate the importance of long-term relationships to female and immature sperm whales, but suggest that relationships are quite homogeneous within social units.