Neck spasms are involuntary contractions of the muscles in your neck. The muscles get tight, hard, and painful. Neck spasms may happen from an injury, overuse, poor posture, or stress. For example, it is common for people who do a lot of computer work to get a stiff neck.