Types (classes) of pain medication. Pain medications are drugs used to relieve discomfort associated with disease, injury, or surgery. Because the pain process is complex, there are many types of pain drugs that provide relief by acting through a variety of physiological mechanisms. Thus, effective medication for nerve pain will likely have a different mechanism of action than arthritis pain medication. Nonsteroidal anti-inflammatory drugs (NSAIDs) act on substances in the body that can cause inflammation, pain, and fever.