Opioids work by binding to specific receptors in the brain, spinal cord, and other parts of the body to reduce the sensation of pain. They mimic the action of endogenous opioids (natural pain-relieving chemicals in the body) but are often more potent.