Stroking the neck in order to relieve the pain
One of the most basic things to try in order to get rid of neck pain is to stroke it fairly gently, until the muscle in pain is relaxed. After that, tilting the head from one side to another can contribute to muscle elasticity and diminish the pain successfully.
If the pain is temporary, this technique should be more than enough to get rid of it. However, if stroking and rolling the neck does not bring any relief to the muscles, that might be a sign that the pain in the muscles of the neck is a symptom of an underlying condition.
Applying ice to the neck in order to relieve the pain
When the intensity of the pain is such that it can become a bit harder to handle, then a simple little massage might be a too mild an action to deal with the issue. What the neck requires then is getting some rest and placing the head in the lying position so that no pressure is put on the neck, and applying some cold compresses to the muscle.
It is not advised to try and ease the pain with exercising because it is more likely to worsen it than do it any good, when it is in that particular condition. However, when the ice compress is held against the neck for a while, the area will become numb and the pain will subside, and after that, one will be able to decide whether the compress was enough or they need some relaxing exercise.
Massaging the neck in order to relieve the pain
If the pain seems to persist even in spite of the previously mentioned tricks to relieve it, one might consider going for a massage somewhere. If massage is known for something, it is for its ability to make the stress and tension go away.
Massage can also be combined with some hot compresses may bring even better results in the release of muscle tension. If the pain seems to be really intense and strong, one might consider adding painkillers to the combination.