Melatonin (N-acetyl-5-methoxytryptamine) is a neurohormone that maintains circadian rhythms1 by synchronization to environmental cues and is involved in diverse physiological processes2 such as the regulation of blood pressure and core body temperature, oncogenesis, and immune function3. Melatonin is formed in the pineal gland in a light-regulated manner4 by enzymatic conversion from 5-hydroxytryptamine (5-HT or serotonin), and modulates sleep and wakefulness5 by activating two high-affinity G-protein-coupled receptors, type 1A (MT1) and type 1B (MT2)3,6. Shift work, travel, and ubiquitous artificial lighting can disrupt natural circadian rhythms; as a result, sleep disorders affect a substantial population in modern society and pose a considerable economic burden7. Over-the-counter melatonin is widely used to alleviate jet lag and as a safer alternative to benzodiazepines and other sleeping aids8,9, and is one of the most popular supplements in the United States10. Here, we present high-resolution room-temperature X-ray free electron laser (XFEL) structures of MT1 in complex with four agonists: the insomnia drug ramelteon11, two melatonin analogues, and the mixed melatonin-serotonin antidepressant agomelatine12,13. The structure of MT2 is described in an accompanying paper14. Although the MT1 and 5-HT receptors have similar endogenous ligands, and agomelatine acts on both receptors, the receptors differ markedly in the structure and composition of their ligand pockets; in MT1, access to the ligand pocket is tightly sealed from solvent by extracellular loop 2, leaving only a narrow channel between transmembrane helices IV and V that connects it to the lipid bilayer. The binding site is extremely compact, and ligands interact with MT1 mainly by strong aromatic stacking with Phe179 and auxiliary hydrogen bonds with Asn162 and Gln181. Our structures provide an unexpected example of atypical ligand entry for a non-lipid receptor, lay the molecular foundation of ligand recognition by melatonin receptors, and will facilitate the design of future tool compounds and therapeutic agents, while their comparison to 5-HT receptors yields insights into the evolution and polypharmacology of G-protein-coupled receptors.