Although electrical neurostimulation has been proposed as an alternative treatment for drug-resistant cases of epilepsy, current procedures such as deep brain stimulation, vagus, and trigeminal nerve stimulation are effective only in a fraction of the patients. Here we demonstrate a closed loop brain-machine interface that delivers electrical stimulation to the dorsal column (DCS) of the spinal cord to suppress epileptic seizures. Rats were implanted with cortical recording microelectrodes and spinal cord stimulating electrodes, and then injected with pentylenetetrazole to induce seizures. Seizures were detected in real time from cortical local field potentials, after which DCS was applied. This method decreased seizure episode frequency by 44% and seizure duration by 38%. We argue that the therapeutic effect of DCS is related to modulation of cortical theta waves, and propose that this closed-loop interface has the potential to become an effective and semi-invasive treatment for refractory epilepsy and other neurological disorders.