Eastham is a town in Barnstable County, Massachusetts, United States, Barnstable County being coextensive with Cape Cod. The population was 5,752 at the 2020 census. For geographic and demographic information about the village of North Eastham, please see North Eastham, Massachusetts.