Yuanshishan is a Ni-Co laterite deposit that occurs in the Lajishan tectonic zone of the South Qilian orogenic belt, NW China. Ni–Co mineralization took place during the weathering of the parental mafic–ultramafic rocks. Little is known about the petrogenesis of these parent rocks. Therefore, field and petrographic investigations, together with in situ major and trace element analyses, were carried out on olivine and clinopyroxene from unweathered mafic–ultramafic rocks in the Yuanshishan Ni-Co deposit. The results show that olivine (Ni 963–2674 ppm, Co 52.7–245 ppm) is richer in Co and Ni than clinopyroxene (Ni 155–203 ppm, Co 23.1–32.5 ppm) in the Yuanshishan mafic–ultramafic rocks. The chromite (Ni 98.8–892 ppm, Co 836–1062 ppm) show higher Co and Ni than clinopyroxene, but has lower Ni but higher Co than olivine. Therefore, olivine and chromite are two main Co and Ni rich minerals in the parent rocks of Yuanshishan. A compositional comparison of olivine and clinopyroxene from the Yuanshishan deposit to those from other magmatic sulfide deposits reveals that the Yuanshishan parent magma is relatively poor in Ni and rich in Co. Olivine in the dunite of Yuanshishan has a quite high Fo value (95.2–98.3). The Yuanshishan olivine grains also show a positive correlation between Ni content and Ni/Co or Co content, and the correlation with Fo value is not obvious. The Co content shows a negative correlation with the Ni content and Fo value, which are consistent with the mantle olivine characteristics. Furthermore, the Li, Sc, V contents in olivine are lower than 10 ppm, indicating that the magma originated from the mantle. The Al, Si, Ti, Ca, and Na contents in clinopyroxene indicate that the original magma may have been subalkaline basaltic melt. Using an olivine-spinel thermometer, the Yuanshishan magma crystallization temperatures are calculated to be 1256–1376 °C. The AlⅣ:AlⅥ ratio (0.7–6.0) and Eu/Eu* value (0.9–1.4) of the clinopyroxene indicate that the Yuanshishan mafic–ultramafic rocks were formed under conditions of low to medium pressure and high oxygen fugacity. Moreover, the geochemical discriminant diagrams of clinopyroxene indicate that these rocks possibly formed in an island arc setting.