Subarachnoid hemorrhage (SAH) is a devastating condition with high morbidity and mortality rates due to the lack of effective therapy. Nucleotide-binding oligomerization domain-like receptor family pyrin domain-containing 3 (NLRP3) inflammasome activation associated with the upregulation of apoptotic signaling pathway has been implicated in various inflammatory diseases including hemorrhagic insults. Melatonin is reported to possess substantial anti-inflammatory properties, which is beneficial for early brain injury (EBI) after SAH. However, the molecular mechanisms have not been clearly identified. This study was designed to investigate the protective effects of melatonin against EBI induced by SAH and to elucidate the potential mechanisms. The adult mice were subjected to SAH. Melatonin or vehicle was injected intraperitoneally 2 hr after SAH. Melatonin was neuroprotective, as shown by increased survival rate, as well as elevated neurological score, greater survival of neurons, preserved brain glutathione levels, and reduced brain edema, malondialdehyde concentrations, apoptotic ratio, and blood-brain barrier (BBB) disruption. Melatonin also attenuated the expressions of NLRP3, apoptosis-associated speck-like protein containing a caspase recruitment domain (ASC), cleaved caspase-1, interleukin-1β (IL-1β), and interleukin-6 (IL-6); these changes were also associated with an increase in the anti-apoptotic factor (Bcl2) and reduction in the pro-apoptotic factor (Bim). In summary, our results demonstrate that melatonin treatment attenuates the EBI following SAH by inhibiting NLRP3 inflammasome-associated apoptosis.