Tramadol is a prescription medication used to treat moderate to moderately severe pain. It belongs to a class of drugs known as opioid analgesics, but it also has properties similar to some antidepressant medications. Tramadol works by binding to opioid receptors in the brain and spinal cord, altering the way your body perceives and responds to pain.