Wenham is a town in Essex County, Massachusetts. The population was 4,979 at the time of the 2020 census. The town of Wenham was settled in 1635 and incorporated in 1643, and is closely tied to its neighboring town of Hamilton, sharing a school system, library, recreation department and commuter rail station.