Situated 5 miles south of the New Hampshire border, the city is bordered by the Gulf of Maine (Atlantic Ocean) to the east, Newbury to the south and southeast, West Newbury to the west and southwest, Amesbury to the north and northwest, and Salisbury to the northeast.