Abstract:[Objectives] The degree of heavy metal pollution and ecological risks in the soil of vegetable greenhouses in Tianshui City, Gansu Province was evaluated in order to provide a scientific basis for the safe production of agricultural products in that area. [Methods] 362 soil samples were obtained from 21 villages and towns in the main greenhouse vegetable production areas of Tianshui City. We used ICP-MS to determine the contents of As, Ni, Cu, Zn, Cd, Pb, and Hg, and employed the Nemerow comprehensive pollution index and potential ecological risk index to evaluate the environmental quality and potential ecological risks of heavy metals in vegetable greenhouse soil. We used correlation analysis and principal component analysis to explore the sources of soil heavy metals. [Results] ① The average contents of As, Ni, Cu, Zn, Cd, Pb, and Hg did not exceed the soil risk screening value of the “Soil Environmental Quality Control Standard for Soil Pollution Risk of Agricultural Land (Trial)” (GB15618-2018). However, compared with the soil background values in Gansu Province, Cu, Zn, Cd, Pb, and Hg had generally accumulated, and were 1.9, 1.4, 3.1, 1.3, and 5.2 times of the background values, respectively; ② The average value of the Nemero composite pollution index was 0.508, and 9.9% of the points showed light and moderate pollution. The average value of the polymetallic potential ecological risk index was 289, and the contribution rate of Hg to the potential ecological risk index was 61.3%; ③ Three principal components of the seven elements were identified. [Conclusion] More than 90% of heavy metals in vegetable greenhouse soil samples were at a safe level, and the potential ecological risk was mild to moderate, with Hg being the largest potential risk factor. Sites with light and moderate pollution and sites with strong and very strong potential ecological risks were concentrated in cities and towns with intensive farming and along densely populated areas and traffic lines.