Gabapentin is a medication primarily used to treat seizures and nerve pain. It belongs to a class of drugs known as anticonvulsants or antiepileptic drugs. Gabapentin works by affecting the transmission of certain chemicals in the brain, specifically neurotransmitters, which helps to decrease abnormal electrical activity associated with seizures and to alleviate nerve pain.