The pigment gland in cotton (Gossypium hirsutum) is a specialized structure that serves as a reservoir for gossypol and its derivatives. The morphogenesis of the pigment gland is complex and involves sophisticated but poorly understood interactions among genes that regulate cell differentiation and development. In this study, we identified a distinct gland/gossypol cluster which includes a key regulator of cotton pigment gland formation, GoPGF, and elucidated the developmental trajectory of gland cells through spatial transcriptome and single-cell RNA integrative analysis. Focusing on GoPGF, we identified a GRAS transcriptional factor GoSPGF that acts upstream of GoPGF through directly binding to the 'AGAC' motif of its promoter. This leads to production of GoPGF that in turn binds to G-box and MYC elements within the promoters of WRKY genes thereby activating their expression. Downregulation of WRKY genes by VIGS in cotton led to dramatic reductions in the number of glands in stems and petioles. Overall, our results delineate a core transcriptional pathway, the GoSPGF-GoPGF-GhWRKYs cascade, that confers pigment gland formation in the stem of cotton. These findings offer new insight into the mechanisms and regulatory pathways underlying cotton gland formation and highlight potential candidates for breeding low-gossypol (glandless) cotton.