Opioid receptors mediate the actions of endogenous and exogenous opioids on many physiological processes, including the regulation of pain, respiratory drive, mood, and—in the case of κ-opioid receptor (κ-OR)—dysphoria and psychotomimesis. Here we report the crystal structure of the human κ-OR in complex with the selective antagonist JDTic, arranged in parallel dimers, at 2.9 Å resolution. The structure reveals important features of the ligand-binding pocket that contribute to the high affinity and subtype selectivity of JDTic for the human κ-OR. Modelling of other important κ-OR-selective ligands, including the morphinan-derived antagonists norbinaltorphimine and 5′-guanidinonaltrindole, and the diterpene agonist salvinorin A analogue RB-64, reveals both common and distinct features for binding these diverse chemotypes. Analysis of site-directed mutagenesis and ligand structure–activity relationships confirms the interactions observed in the crystal structure, thereby providing a molecular explanation for κ-OR subtype selectivity, and essential insights for the design of compounds with new pharmacological properties targeting the human κ-OR. The crystal structure of the human κ-opioid receptor in complex with an antagonist, JDTic, is determined, with potential importance for the design of new therapeutic agents. Four papers in this issue of Nature present the long-awaited high-resolution crystal structures of the four known opioid receptors in ligand-bound conformations. These G-protein-coupled receptors are the targets of a broad range of drugs, including painkillers, antidepressants, anti-anxiety agents and anti-addiction medications. Brian Kobilka’s group reports the crystal structure of the µ-opioid receptor bound to a morphinan antagonist and the δ-opioid receptor bound to naltrindole. Raymond Stevens’ group reports on the κ-opioid receptor bound to the selective antagonist JDTic, and the nociceptin/orphanin FQ receptor bound to a peptide mimetic. In an associated News and Views, Marta Filizola and Lakshmi Devi discuss the implications of these landmark papers for research on the mechanisms underlying receptor function and drug development.