Postoperative pain affects most patients after major surgery and can transition to chronic pain. Here, we discovered that postoperative pain hypersensitivity correlated with markedly increased local levels of the metabolite BH4. Gene transcription and reporter mouse analyses after skin injury identified neutrophils, macrophages and mast cells as primary postoperative sources of GTP cyclohydrolase-1 ( ) expression, the rate-limiting enzyme in BH4 production. While specific deficiency in neutrophils or macrophages had no effect, mice deficient in mast cells or mast cell-specific showed drastically decreased postoperative pain after surgery. Skin injury induced the nociceptive neuropeptide substance P, which directly triggers the release of BH4-dependent serotonin in mouse and human mast cells. Substance P receptor blockade substantially ameliorated postoperative pain. Our findings underline the unique position of mast cells at the neuro-immune interface and highlight substance P-driven mast cell BH4 production as promising therapeutic targets for the treatment of postoperative pain.