There are several causes for muscle spasms in dogs. The spasms could be caused by a pinched nerve, seizures, neurological complications, or Canine Stress Syndrome.
Spasms can be neurological or physical, or caused by toxins, viruses. The cause may be as worriesome as epilepsy or as simple as over-extertion. Best to see your vet.
Complications due to an Injury, Canine epilepsy, Degenerative Myelopathy, Canine Stress Syndrome, Hypoglycemia, Distemper, CNS Failure, Brain tumors, encephalitis, and some bladder issues