Merrimac is a town in Essex County, Massachusetts, United States, and on the southeastern border of New Hampshire, approximately 34 miles (55 km) northeast of Boston. It is situated along the north bank of the Merrimack River in the Merrimack Valley. The population was 6,504 in 2008. Historically a manufacturing center, it has long since become a largely residential community. It is part of the Greater Boston metropolitan area.