CB(2) cannabinoid receptor-selective agonists are promising candidates for the treatment of pain. CB(2) receptor activation inhibits acute, inflammatory, and neuropathic pain responses but does not cause central nervous system (CNS) effects, consistent with the lack of CB(2) receptors in the normal CNS. To date, there has been virtually no information regarding the mechanism of CB(2) receptor-mediated inhibition of pain responses. Here, we test the hypothesis that CB(2) receptor activation stimulates release from keratinocytes of the endogenous opioid beta-endorphin, which then acts at opioid receptors on primary afferent neurons to inhibit nociception. The antinociceptive effects of the CB(2) receptor-selective agonist AM1241 were prevented in rats when naloxone or antiserum to beta-endorphin was injected in the hindpaw where the noxious thermal stimulus was applied, suggesting that beta-endorphin is necessary for CB(2) receptor-mediated antinociception. Further, AM1241 did not inhibit nociception in mu-opioid receptor-deficient mice. Hindpaw injection of beta-endorphin was sufficient to produce antinociception. AM1241 stimulated beta-endorphin release from rat skin tissue and from cultured human keratinocytes. This stimulation was prevented by AM630, a CB(2) cannabinoid receptor-selective antagonist and was not observed in skin from CB(2) cannabinoid receptor-deficient mice. These data suggest that CB(2) receptor activation stimulates release from keratinocytes of beta-endorphin, which acts at local neuronal mu-opioid receptors to inhibit nociception. Supporting this possibility, CB(2) immunolabeling was detected on beta-endorphin-containing keratinocytes in stratum granulosum throughout the epidermis of the hindpaw. This mechanism allows for the local release of beta-endorphin, where CB(2) receptors are present, leading to anatomical specificity of opioid effects.