We investigated the horizontal and vertical distribution of heavy metals (Hg, Pb, Zn, Cu, Cd, As, Ni, and Cr) in soils in the water source protection zone for Shanghai to study the origins of these metals, their connections with urbanization, and their potential risk posed on the ecosystem. Determination of metal concentrations in 50 topsoil samples and nine soil profiles indicated that Hg, Pb, Zn, and Cu were present in significantly higher concentrations in topsoil than in deep soil layers. The spatial distributions of Hg, Pb, Zn, and Cu and contamination hotspots for these metals in the study area were similar to those near heavy industries and urban built-up areas. Emissions from automobiles resulted in increased soil concentrations of Cu, Pb, and Zn along roadsides, while high concentrations of Hg in the soil resulted from recent atmospheric deposition. Calculation of the potential ecological risk indicated that the integrative risk of these heavy metals in most areas was low, but a few sites surrounding high density of factories showed moderate risks.