Daye is a city in China known for its rich mineral resources, with a history of metal mining and smelting that dates back more than 3000 years. To analyze the spatial distribution patterns, ecological risk, and sources of heavy metals (Cd, Co, Cr, Cu, Mn, Ni, Pb, and Zn) in soils, 213 topsoil samples were collected in the main urban area of Daye in September 2016. The mean concentrations of Cd, Cu, Pb, and Zn were higher than the corresponding background values, with the mean concentration of Cd being almost seven times its background value. Spatially, the high concentrations of Cd, Mn, Pb, and Zn were mainly concentrated in the southeastern part of the region due to nonferrous metal mining and smelting. However, the high concentrations of Co and Cu were concentrated in the central part of the study area, resulted from copper mining and smelting. The data of the geoaccumulation index showed that the contamination levels ranged from no pollution (Co, Cr, Mn, and Ni) to heavy contamination (Cd, Cu, and Pb). Ecological risk assessment showed that Cd posed a high, serious, and even severe ecological risk in 53.78% of the area of Daye. According to the results of the principal component analysis, mineral exploitation and smelting involving a variety of minerals (ES_M), mining exploitation, and smelting of copper ore (ES_C), and natural sources are the three main sources of heavy metals in these soils. Furthermore, the absolute principal component scores showed that 69.21% and 23.17% of the heavy metal concentrations were ascribed to ES_M and ES_C, respectively.