The in vitro or ex vivo production of transplantable hematopoietic stem cells (HSCs) holds great promise for the treatment of hematological diseases in the clinic. However, HSCs have not been produced from either embryonic or induced pluripotent stem cells. In this study, we report that 5-hydroxytryptamine (5-HT; also called serotonin) can enhance the generation of hematopoietic stem and progenitor cells (HSPCs) in vitro and is essential for the survival of HSPCs in vivo during embryogenesis. In tryptophan hydroxylase 2–deficient embryos, a decrease in 5-HT synthesized in the aorta-gonad-mesonephros leads to apoptosis of nascent HSPCs. Mechanistically, 5-HT inhibits the AKT-Foxo1 signaling cascade to protect the earliest HSPCs in intraaortic hematopoietic clusters from excessive apoptosis. Collectively, our results reveal an unexpected role of 5-HT in HSPC development and suggest that 5-HT signaling may be a potential therapeutic target for promoting HSPC survival.