A spasm is a sudden, involuntary contraction of a muscle or a group of muscles. Nerve damage can lead to a prolonged or permanent muscle shortening called contracture.