Hi friends. Too many posts for me to tell if someone has already suggested these things or not. I'll let you be your own filter.
I have suffered from headaches due to a pinched nerve in the neck, triggering muscle spasms like you describe. I loose pressure in a disk I think, micro-fissure due to a car accident is my hypothesis. This is in my neck above the shoulder line so if yours is in a different place maybe your mileage will vary. But this is what is working for me:
1) drink enough fluids. If I drink enough (which tends to be a bit more than "normal" so I kind of have to force myself) it definitely helps keep the disk from being robbed of fluids (I can actually hear it leaking out if I feel thirsty for too long...weird I know!)
2) used to be 4 advil (800mg, the max dose prescribed by a doctor to my wife to knock down her back pain inflammation), and 1000mg tylenol before bed, plus sleeping on an ice pack would work. But I stopped with these meds because of the possible danger. I now use aspirin and tylenol according to directions. The point being inflammation causes pain and tension which causes more inflammation, so if you can knock the inflammation down all at once (hence the high does of Advil) it can start to break the tension cycle. Any anti-inflammatory should help then. My wife was able to stop the Advil trick after a steroid shot to the area.
3) Ice pack is something like this: Chattanooga ColPac Cold Therapy, Blue Vinyl, Standard-Size Cold Pack (11" x 14") https://www.amazon.com/dp/B000EAPNCQ/ref=cm_sw_r_cp_awd_YRkSwbG84M2HJ
I find the larger size better, I can lay it under my head and back, then wrap the side up around my neck and shoulders a little when laying on my back.
4) light traction by: laying on my back with my knees bent, then tucking my ice pack/pillow up under the arch of my neck to support it, then lower my knees. This shifts my body slightly to put gentle traction on the spine.
5) Calms Forte. Hyland's Calms Forte Sleep Aid Tablets, Natural Stress and Sleep Relief, 300 Count https://www.amazon.com/dp/B001EPQ43C/ref=cm_sw_r_cp_awd_7YkSwbX8MTKZG
. I take 4 (sometimes 5) at once before bed, as a muscle relaxant. Sometimes I take 2 or 3 (plus coffee!) in the morning to continue the effect. Sometimes I smash the tabs in a spoon of vodka and let it soak a bit, then hold the mixture under my tongue for a few minutes to absorb it more quickly before swallowing.
6) A blend of peppermint, rosemary verbenone ("rosemary" is different and not the same effect, but is better than none if you can't find the verbenone type), and eucalyptus essential oils, in a pretty high concentration. Something like 2 parts peppermint, 1 part rosemary, .5 part Eucalyptus, 1 part carrier oil, maybe? I'm still working on what is best, but one time out of desperation I tried these in some random formulation and pow! My muscles relaxed. I actually felt them trying to tense, them being forced to relax, over and over. They couldn't maintain their tension. Now that I think about it, it may have been coupled with Calms Forte. Note also that time it was definitely rosemary verbenone in the mix (not just rosemary, which I hear is different). I carry a little roller bottle of the mix in my pocket, apply it if/when I feel my muscles starting to tense up. And note that I tried each of these oils separately and in pairs; only the trio together had the right effect.
7) Recently I've tried alternating the ice pack with a hot pad every 10-30 minutes, that seems to really help.
THIS has been the key recently: Cervical Neck Traction Device for Head & Shoulder Pain - Inflatable Neck Pillow / Cervical Traction Pillow - #1 Doctors Recommended - Improved Home Cervical Traction Device with Adjustable Size, Bigger Pump, Extended Velcro, Premium, Durable & High Quality https://www.amazon.com/dp/B00U0K4RPO/ref=cm_sw_r_cp_awd_BalSwbXZK2DAP
I wear it for 20ish minutes at a time. Buried in the reviews (for this model or another) someone suggested that (20 minutes?) a day for a month and your body will change posture and strengthen muscles to help hold your neck straighter and heal properly, so after a while you won't need it anymore. I'm going on 2-3 weeks now and I definitely have fewer problems and headaches than I used to. Besides tractioning my neck, it forces my shoulders more down and back, which is a necessary posture to take the pressure off my neck.
9) I raised my computer monitor to eye level so I can maintain my head balance. Letting it tip forward to look down all day (I program for a career) was a killer. Also learn touch typing so you don't have to look at the keys. Now I stand at my desk with monitor at eye level and it makes a huge difference.
Good luck! Hope you find the right solution for you.