Our study area is the upstream watershed of the Guanting and Miyun Reservoirs; together, these two reservoirs comprise the main drinking water source of Beijing, China. In order to prevent crop contamination and preserve the quality of the water and soil, it is important to investigate the spatial distribution and the sources of the heavy metals in farmland soils on the watershed scale. For this study, we collected 23,851 farmland surface soil samples. Based on our analysis of the concentrations of eight heavy metals in these samples, we found that the overall soil quality in our study area is excellent, but that the Cd, Cu, Zn, and Cr contamination risks are relatively high. Moreover, a percentage of samples exceeded the Cd (1.54%,), Cu (0.28%), Zn (0.25%), Cr (0.13%), Pb (0.09%), As (0.05%), Ni (0.04%), and Hg (0.02%) risk screening values for soil contamination in agricultural land. In addition to determining the spatial distribution characteristics of the heavy metal concentrations of the soil samples, we also conducted a factor analysis and an R cluster analysis (CA) whcih can gathered the similar variables to track the sources of the heavy metals. We found that the Cd, Pb, and Zn are likely sourced from a quartz syenite porphyry body and from coal-fired enterprises, while the Cr, Cu, and Ni contaminations are mainly caused by runoff from iron ore smelting. Additionally, agricultural production contributes to the local accumulation of Cu, and industrial (smelting) discharge is partially responsible for the As contamination. As a result of the atmospheric deposition of pollutants, areas with high Hg concentrations are generally centered on large- and medium-sized cities. Due to these high natural heavy metal background values, the existing and future heavy metal contamination in the watershed poses a serious ecological risk to both the soil and the surface water.