Hi,Thanks for query,
It seems that while turning your head very suddenly,your neck muscles might got stretched and went into the spasm created this problem.
As now you are alright,nothing to worry.
You can apply some analgesic
cream and do hot fomentation.
For few days move your head slowly and gently.
Ok and bye.