The analgesic effect of clinically used exogenous opioids, such as morphine, is mediated primarily through mu-opioid receptors, but the function of the kappa-receptor in opioid analgesia is unclear. Although kappa-receptor agonists can produce analgesia, behavioural studies indicate that kappa agonists applied intravenously or locally into the spinal cord antagonize morphine analgesia. As morphine, a primary mu agonist, also binds to kappa-receptors and the analgesic effectiveness of morphine decreases with repeated use (tolerance), it is important to understand the mechanism for the functional interaction between kappa- and mu-opioid receptors in the central nervous system. Here we present in vitro electrophysiological and in vivo behavioural evidence that activation of the kappa-receptor specifically antagonizes mu-receptor-mediated analgesia. We show that in slice preparations of a rat brainstem nucleus, which is critical for the action of opioids in controlling pain, functional kappa- and mu-receptors are each localized on physiologically different types of neuron. Activation of the kappa-receptor hyperpolarizes neurons that are activated indirectly by the mu-receptor. In rats, kappa-receptor activation in this brainstem nucleus significantly attenuates local mu-receptor-mediated analgesia. Our findings suggest a new cellular mechanism for the potentially ubiquitous opposing interaction between mu- and kappa-opioid receptors and may help in the design of treatments for pain.