To determine whether stress-evoked release of endogenous opioids might account for hypoalgesia in major depressive disorder (MDD), the µ-opioid antagonist naltrexone (50 mg) or placebo was administered double-blind to 24 participants with MDD and to 31 non-depressed controls. Eighty minutes later participants completed a painful foot cold pressor test and, after a 5-minute interval, began a 25-minute arithmetic task interspersed with painful electric shocks. Ten minutes later participants completed a second cold pressor test. Negative affect was greater in participants with MDD than in non-depressed controls throughout the experiment, and increased significantly in both groups during mental arithmetic. Before the math task, naltrexone unmasked direct linear relationships between severity of depression, negative affect while resting quietly, and cold-induced pain in participants with MDD. In contrast, facilitatory effects of naltrexone on cold-and shock-induced pain were greatest in controls with the lowest depression scores. Naltrexone strengthened the relationship between negative affect and shock-induced pain during the math task, particularly in the depressed group, and heightened anxiety in both groups toward the end of the task. Thus, µ-opioid activity apparently masked a positive association between negative affect and pain in the most distressed participants. These findings suggest that psychological distress inhibits pain via stress-evoked release of opioid peptides in severe cases of MDD. In addition, tonic endogenous opioid neurotransmission could inhibit depressive symptoms and pain in people with low depression scores.