Spasms after spinal cord injury (SCI) are debilitating involuntary muscle contractions that have been associated with increased motor neuron excitability and decreased inhibition. However, whether spasms involve activation of premotor spinal excitatory neuronal circuits is unknown. Here we use mouse genetics, electrophysiology, imaging and optogenetics to directly target major classes of spinal interneurons as well as motor neurons during spasms in a mouse model of chronic SCI. We find that assemblies of excitatory spinal interneurons are recruited by sensory input into functional circuits to generate persistent neural activity, which interacts with both the graded expression of plateau potentials in motor neurons to generate spasms, and inhibitory interneurons to curtail them. Our study reveals hitherto unrecognized neuronal mechanisms for the generation of persistent neural activity under pathophysiological conditions, opening up new targets for treatment of muscle spasms after SCI.