Methadone belongs to the opioid family of drugs. Examples of other opioids are oxycodone (OxyContin or Percocet), fentanyl, hydromorphone (Dilaudid), heroin, morphine, codeine, etc. This is the reason why methadone works similarly as a pain reliever.
While methadone is an opioid as mentioned, there are some differences between methadone and the other opioids. The main difference is methadone's much slower metabolism. While the other opioids reach peak action within minutes or seconds (if injected or inhaled), methadone can take 3-4 hours to reach its peak action. Due this slower metabolism, methadone stays in the body much longer too -often days as opposed to hours for the other opioids. This allows a more even and stable action of the medication as opposed to the rapid onset and offset of a short acting opioid such as morphine or oxycodone. So while methadone exerts its opiate-like effect, it does it in a slower and more controlled way. This effect is one that is desired for an individual addicted to the euphoria or "high" achieved from the rapid-acting opioids. While methadone provides a relief from the symptoms of withdrawal such as aches, chills, and cramps and the mental effects of craving for the high, it does not produce a high itself. Further, since methadone at an adequate dose binds the opioid receptors in the brain, there is no much room for the other opioids to bind themselves. In this manner, methadone is said to block the other opioids if taken.
The other way that methadone is different than the other opioids is that in addition to its opioid effects and unlike the other opioids, it has action against a separate nervous system in the body referred to as the NMDA receptor system. By blocking these receptors, methadone user are able to achieve a stable dose of methadone without need for any ever-increasing dosage to reproduce the same mental effects, as seen in the nature of morphine or oxycodone. This is the reason why patients on a stable dose of methadone are able to do stay on this dose for months or even years.