Delta-9-tetrahydrocannabinol (THC), the main psychoactive compound of marijuana, induces numerous undesirable effects, including memory impairments, anxiety, and dependence. Conversely, THC also has potentially therapeutic effects, including analgesia, muscle relaxation, and neuroprotection. However, the mechanisms that dissociate these responses are still not known. Using mice lacking the serotonin receptor 5-HT2A, we revealed that the analgesic and amnesic effects of THC are independent of each other: while amnesia induced by THC disappears in the mutant mice, THC can still promote analgesia in these animals. In subsequent molecular studies, we showed that in specific brain regions involved in memory formation, the receptors for THC and the 5-HT2A receptors work together by physically interacting with each other. Experimentally interfering with this interaction prevented the memory deficits induced by THC, but not its analgesic properties. Our results highlight a novel mechanism by which the beneficial analgesic properties of THC can be dissociated from its cognitive side effects.