Melatonin exerts direct neuroprotection against cerebral hypoxic damage, but the mechanisms of its action on microglia have been less characterized. Using both in vitro and in vivo models of hypoxia, we here focused on the role played by silent mating type information regulation 2 homolog 1 (SIRT1) in melatonin’s effects on microglia. Viability of rat primary microglia or microglial BV2 cells and SH-SY5Y neurons was significantly reduced after chemical hypoxia with CoCl2 (250 μM for 24 h). Melatonin (1 μM) significantly attenuated CoCl2 toxicity on microglia, an effect prevented by selective SIRT1 inhibitor EX527 (5 μM) and AMP-activated protein kinase (AMPK) inhibitor BML-275 (2 μM). CoCl2 did not modify SIRT1 expression, but prevented nuclear localization, while melatonin appeared to restore it. CoCl2 induced nuclear localization of hypoxia-inducible factor-1α (HIF-1α) and nuclear factor-kappa B (NF-kB), an effect contrasted by melatonin in an EX527-dependent fashion. Treatment of microglia with melatonin attenuated potentiation of neurotoxicity. Common carotid occlusion was performed in p7 rats, followed by intraperitoneal injection of melatonin (10 mg/kg). After 24 h, the number of Iba1+ microglia in the hippocampus of hypoxic rats was significantly increased, an effect not prevented by melatonin. At this time, SIRT1 was only detectable in the amoeboid, Iba1+ microglial population selectively localized in the corpus callosum. In these cells, nuclear localization of SIRT1 was significantly lower in hypoxic animals, an effect prevented by melatonin. NF-kB showed an opposite expression pattern, where nuclear localization in Iba1+ cells was significantly higher in hypoxic, but not in melatonin-treated animals. Our findings provide new evidence for a direct effect of melatonin on hypoxic microglia through SIRT1, which appears as a potential pharmacological target against hypoxic-derived neuronal damage.