The tumor microenvironment plays an important role in tumor growth and malignancy. However, the mechanisms by which cells or the tumor milieu regulate the malignancy of glioblastoma have not been clearly elucidated. Here, we demonstrated that increased infiltration of ATP-primed microglia into the perinecrotic tumor regions of glioblastoma can promote the mesenchymal transition and is correlated with the poor prognosis of patients. The primed microglia increased the secretion of cytokines, mainly IL-6 and RANTES, thereby activating STAT3 signaling, which promotes the mesenchymal signature and stem cell properties of glioblastoma. However, STAT3 silencing by siRNA abolished these signature and properties. We identified the small-molecule compound ODZ10117 as a STAT3 inhibitor for treating glioblastoma. ODZ10117 inhibited STAT3 activation in microglia and suppressed mesenchymal signature, stem cell properties, and migration and invasion, as well as induced apoptotic cell death by inhibiting STAT3 signaling in glioblastoma and glioma stem cells (GSCs). Collectively, ATP-mediated microglial activation is a key regulatory factor to promote glioblastoma malignancy through STAT3 signaling, and ODZ10117 is a promising therapeutic candidate for glioblastoma by targeting STAT3.