Heavy metal pollution is a widespread phenomenon in many countries of the world. In this study, we conducted a field investigation to assess the status of heavy metal pollution in urban soils of Dushanzi, a district of Karamay city in Xinjiang, China. A total of 56 soil samples in the topsoil layer of 0–15 cm were collected within the urban area and seven elements (Cu, Zn, Cd, Pb, Cr, As and Ni) were analyzed. The mean concentrations of these metals were all higher than their corresponding background values of soils in Xinjiang. We used the pollution index and ecological risk index to assess the degree of heavy metal pollution and the potential ecological risk of urban soils. The pollution index values of Cu, Zn, Cd, Pb, Cr, As and Ni were 1.81, 1.35, 4.64, 1.27, 1.80, 1.39 and 1.22, respectively; and the potential ecological risk index values for them were 12.03, 1.79, 185.05, 8.39, 4.78, 18.44 and 1.79, respectively. These results indicated that urban soils in Dushanzi were polluted by heavy metals to some extent and demonstrated a high ecological risk, as influenced by industrial activities. Cd was the key element for the metal pollution of urban soils in the study area. Correlation analyses, principal component analysis coupled with the spatial distribution maps of element concentrations further revealed that heavy metal pollution of urban soils can be mainly attributed to petrochemical industry, coal chemical industry, traffic and commercial activities.