Ask a Neurologist. Get Answers to Your Neurology Questions.
since you remain offline, I will leave an answer, please review this information and return to ask questions, I will return to reply.
You have cervical spasm that cah be from a variety of conditions, usually it is dehydration of muscles or an electrolyte balance within the muscle that makes it susceptible to cramping when stretched. Low potassium, calcium, magnesium are common electrolytes that can cause this effect, and the treatment would be hydration with electrolytic solutions like gatorade.
Spasm can also be a result of nerve injury from anatomic problems putting pressure onto specific nerve roots as they exit the cervical spinal cord and pass through the vertebra. That will give spasm and possibly segmental numbness, weakness and pain. The dorsal roots which are the first branches off the cervical roots, innervate the paraspinal muscles or cervical muscles around your neck.
A third possibility, although less likely, is that you have a rare movement disorder called cervical dystonia. In this condition you can have forcible contraction of neck muscles with stimuli like yawning or stretching. This type of problem can be familial, and if you have family members with similar conditions, please get back to me. And finally, there are conditions that effect the cervical spinal cord, diseases such as MS or demyelinating conditions of the cord itself like Devic's that can cause this type of problem, much more rare and down the line on the chances list. Please get back to me to discuss those possibilities.
I hope I was able to give you some direction if making a diagnosis and starting a treatment. Please rate my answer if satisfied as that is how I get compensation for my work Dr Frank T.