This is most likely to be due to a muscle spasm.
Muscle spasm will cause these symptoms. It will cause pain along with muscle twitching.
Treatment is with warm compresses and stretching exercises: apply warm compresses with a warm towel.
Also do regular stretching exercises of the neck.
Do these neck stretching ROM exercises: Neck Flexion (Chin to Chest) -
Slowly begin to lower you neck down by lower your chin down to your check and hold for 10-15 seconds. Neck Extension (Lean your head back) -
Lower your head back as far as you can. Right Lateral Flexion (Ear to Shoulder)
- Lower your right ear towards your right shoulder. Left Lateral Flexion (Ear to Shoulder)
- Lower your left ear towards your left shoulder. Right Rotation (Chin to Shoulder)
- Slowly turn your head to the right. Your chin with be close to your right shoulder. Left Rotation (Chin to Shoulder)
- Slowly turn your head to the left. Your chin with be close to your left shoulder.( source)
Take care - warm compresses with neck stretching exercises will give relief - if it persists show your doctor.
I hope my answer has helped you. Please click on the green 'accept' button below for accepting this answer. Feedback/Bonus will be appreciated. Do not hesitate to ask further questions if you need more info.
Dr. P.Jyoti, MD.