Mucositis is a common and distressing side effect of chemotherapy or radiotherapy that has potentially severe consequences, and no treatment is available. The purpose of this study was to analyze the molecular pathways involved in the development of oral mucositis and to evaluate whether melatonin can prevent this pathology. The tongue of male Wistar rats was subjected to irradiation (X-ray YXLON Y.Tu 320-D03 irradiator; the animals received a dose of 7.5 Gy/day for 5 days). Rats were treated with 45 mg/day melatonin or vehicle for 21 days postirradiation, either by local application into their mouths (melatonin gel) or by subcutaneous injection. A connection between reactive oxygen species, generating mitochondria and the NLRP3 (NLR-related protein 3 nucleotide-binding domain leucine-rich repeat containing receptor-related protein 3) inflammasome, has been reported in mucositis. Here, we show that mitochondrial oxidative stress, bioenergetic impairment and subsequent NLRP3 inflammasome activation are involved in the development of oral mucositis after irradiation and that melatonin synthesized in the rat tongue is depleted after irradiation. The application of melatonin gel restores physiological melatonin levels in the tongue and prevents mucosal disruption and ulcer formation. Melatonin gel protects the mitochondria from radiation damage and blunts the NF-κB/NLRP3 inflammasome signaling activation in the tongue. Our results suggest new molecular pathways involved in radiotherapy-induced mucositis that are inhibited by topical melatonin application, suggesting a potential preventive therapy for mucositis in patients with cancer.