What causes neck and back pain and muscle rigidity?

Muscle spasm. There are many causes of neck and back pain including sprains, strains, and arthritis to name a few. Muscle rigidity or "muscle spasm" is often your body's response to pain or injury. In some instances the muscle itself is injured or stressed which results in "stiffness".