Stress is known to cause neuropsychiatric diseases, and it has a detrimental impact on the function of the immune system. Melatonin (MLT), a pineal gland hormone, exhibits potent anti-inflammatory properties and it plays a fundamental role in neuroimmunomodulation. In the present study, we investigated the molecular mechanisms of MLT in stress-induced inflammation, focusing on macrophage polarization. MLT (50 and 100 mg/kg) or a vehicle control (5% ethanol in saline) was intraperitoneally administered to mice once a day for 5 days. After the last treatment, mice were subjected to restraint stress (RS) for 2 h. MLT markedly decreased serum levels of corticosterone after RS. RS significantly increased serum interleukin (IL)-1β and IL-6 levels, and it decreased serum IL-10 levels. MLT administration attenuated these changes. After RS, MLT markedly decreased lipid peroxidation and increased hepatic glutathione content. In purified Kupffer cells (KCs) and peritoneal macrophages from mice exposed to RS, the expression levels of M1 marker genes (NOS2a and CD40) increased, while the expression levels of an M2 marker gene (Arg1) decreased. MLT attenuated this increase in expression of M1 marker genes and decrease in the expression levels of the M2 marker gene. Furthermore, in KCs and peritoneal macrophages exposed to RS, MLT decreased the number of F4/80+ CD86+ cells and increased the number of F4/80+ MRC1+ cells. In splenocytes exposed to RS, MLT inhibited the increase in mRNA expression of NOS2a. MLT downregulated expression of phosphorylated signal transducer and activator of transcription (STAT) 1 and upregulated STAT3 protein expression. Our findings suggest that MLT reduces stress-induced inflammatory responses by inducing an M1 to M2 phenotype switch in macrophages via activation of STAT3 signaling.