This article is from the Bicycles FAQ, by Mike Iglesias with numerous contributions by others.
Ice is a great way to reduce pain and inflamation. A good way to apply
ice is to freeze water in a paper cup. Peel the cup back to expose the
ice and then use the cup as a handle while gently rubbing the ice over
the effected area. Ice is particularly good for the first couple of
days. Some people find that it's useful to continue ice treatments
beyond that. Others find that the ice treatments make their backs tight
if they continue beyond a couple of days.
Heat, especially moist heat, can be useful. However, it should not be
used for a couple of days after injuring your back or after aggravating a
current injury. Regardless of the timing, if you feel worse during or
shortly after heat treatment, stop doing it.
In the later stages of a back problem, I find that my low back muscles
get tight. Gentle massage seems to help them relax, promoting the
healing process. I suspect that massage could make things worse in some
cases, such as when the injury is fresh.