Depends on cause. This really depends on what us causing the spasm. It could be a herniated disc or something else pinching the nerve, it could be a muscle strain, a simple cramp, an electrolyte abnormality or something ominous. You should take this to your doctor for a careful evaluation.
See physiatrist. A muscle that goes into spasm usually does so in response to some type of underlying problem, often deeper than the muscle itself. A physiatrist who specializes in musculoskeletal disorders is usually well trained to figure this out.