Yes it is possible weight training is doing it (or more accurately, weight training with possible bad form) but it could be other things too.
My suggestion as always, get a referral to a neurologist and check out if anything is wrong. Probably nothing is, but better to be sure. I MEAN IT. You doctor won't necessarily be good enough to know. In fact, a lot of neuros might not be good enough to know either.
The bottom line is, you should NOT be getting neck spasms, you should NOT be getting headaches, if you are then something is wrong, it is almost certainly something trivial to do with muscle imbalances.
Do you now or have you ever done any bridging work or other neck work? My guess is not. But that is just a guess and you really should see a neuro and check that nothing is wrong. Because if you get advice here like "oh yeah I had that it is no problem" and it turns out there IS something wrong and you make it worse then you is screwed.