Maternal infection/inflammation represents one of the most important factors involved in the etiology of brain injury in newborns. We investigated the modulating effect of prenatal melatonin on the neonatal brain inflammation process resulting from maternal intraperitoneal (i.p.) lipopolysaccharide (LPS) injections. LPS (300 μg/kg) was administered to pregnant rats at gestational days 19 and 20. Melatonin (5 mg/kg) was administered i.p. at the same time as LPS. Melatonin counteracted the LPS sensitization to a second ibotenate-induced excitotoxic insult performed on postnatal day (PND) 4. As melatonin succeeded in reducing microglial activation in neonatal brain at PND1, pathways previously implicated in brain inflammation regulation, such as endoplasmic reticulum (ER) stress, autophagy and silent information regulator 1 (SIRT1), a melatonin target, were assessed at the same time-point in our experimental groups. Results showed that maternal LPS administrations resulted in an increase in CHOP and Hsp70 protein expression and eIF2α phosphorylation, indicative of activation of the unfolded protein response consequent to ER stress, and a slighter decrease in the autophagy process, determined by reduced lipidated LC3 and increased p62 expression. LPS-induced inflammation also reduced brain SIRT1 expression and affected the expression of miR-34a, miR146a, and miR-126. All these effects were blocked by melatonin. Cleaved-caspase-3 apoptosis pathway did not seem to be implicated in the noxious effect of LPS on the PND1 brain. We conclude that melatonin is effective in reducing maternal LPS-induced neonatal inflammation and related brain injury. Its role as a prophylactic/therapeutic drug deserves to be investigated by clinical studies.