Electrical neuromodulation of lumbar segments improves motor control after spinal cord injury in animal models and humans. However, the physiological principles underlying the effect of this intervention remain poorly understood, which has limited the therapeutic approach to continuous stimulation applied to restricted spinal cord locations. Here we developed stimulation protocols that reproduce the natural dynamics of motoneuron activation during locomotion. For this, we computed the spatiotemporal activation pattern of muscle synergies during locomotion in healthy rats. Computer simulations identified optimal electrode locations to target each synergy through the recruitment of proprioceptive feedback circuits. This framework steered the design of spatially selective spinal implants and real-time control software that modulate extensor and flexor synergies with precise temporal resolution. Spatiotemporal neuromodulation therapies improved gait quality, weight-bearing capacity, endurance and skilled locomotion in several rodent models of spinal cord injury. These new concepts are directly translatable to strategies to improve motor control in humans.