Decline in semen quality has become a global public health concern. Psychological stress is common in the current modern society and is associated with semen decline. Increasing evidence demonstrated that melatonin has anti-apoptotic and antioxidant functions. Whether melatonin can ameliorate the damage in testes induced by psychological stress has never been investigated. Here, a mouse model of restraint stress demonstrated that melatonin normalized the sperm density decline, testicular cells apoptosis, and testicular oxidative stress in stressed male mice. Melatonin decreased reactive oxygen species (ROS) level, increased superoxide dismutase (SOD) and glutathione (GSH) activities, and downregulated inducible nitric oxide synthase (iNOS) and tumor necrosis factor-α (TNF-α) activities in stressed mice testes. Furthermore, melatonin reduced the stress-induced activation of the NF-κB signaling pathway by decreasing the phosphorylation of nuclear factor of kappa light polypeptide gene enhancer in B-cells inhibitor, alpha (IκBα) and p65 nuclear translocation. In addition, melatonin upregulated the expression of anti-oxidant proteins including nuclear factor erythroid 2-related factor 2 (Nrf2) and heme oxygenase-1 (HO-1). Meanwhile, in vitro studies also demonstrated melatonin could reduce oxidative apoptosis of testicular cells. Collectively, melatonin mitigated psychological stress-induced spermatogenic damage, which provides evidence for melatonin as a therapy against sperm impairment associated with psychological stress.