Aims. This study was performed to explore the effect of melatonin on pyroptosis in nucleus pulposus cells (NPCs) and the underlying mechanism of that effect. Methods. This experiment included three patients diagnosed with lumbar disc herniation who failed conservative treatment. Nucleus pulposus tissue was isolated from these patients when they underwent surgical intervention, and primary NPCs were isolated and cultured. Western blotting, reverse transcription polymerase chain reaction, fluorescence staining, and other methods were used to detect changes in related signalling pathways and the ability of cells to resist pyroptosis. Results. Western blot analysis confirmed the expression of cleaved CASP-1 and melatonin receptor (MT-1A-R) in NPCs. The cultured NPCs were identified by detecting the expression of CD24, collagen type II, and aggrecan. After treatment with hydrogen peroxide, the pyroptosis-related proteins NLR family pyrin domain containing 3 (NLRP3), cleaved CASP-1, N-terminal fragment of gasdermin D (GSDMD-N), interleukin (IL)-18, and IL-1β in NPCs were upregulated, and the number of propidium iodide (PI)-positive cells was also increased, which was able to be alleviated by pretreatment with melatonin. The protective effect of melatonin on pyroptosis was blunted by both the melatonin receptor antagonist luzindole and the nuclear factor erythroid 2–related factor 2 (Nrf2) inhibitor ML385. In addition, the expression of the transcription factor