Responses of soil organic matter (SOM) to changes in temperature and precipitation were helpful to understanding biogeochemical processes in soils. In the current study, two groups of soil samples were used to distinguish the respective effects of precipitation and temperature on SOM. The first group was named as mean annual temperature (MAP) gradient group including 13 samples with similar mean annual temperature (MAT) (13.0–14.9 °C) but different MAP (71.4–1072.8 mm). The second group was named as MAT gradient group including 13 samples with high MAP (> 1000 mm) but different MAT (15.9–24.8 °C). The SOM molecular composition was analyzed by a pyrolysis gas chromatography mass spectrometry. Variance partitioning analysis showed that in the MAP gradient group the variation in SOM composition was only independently explained 1% and 6% by MAT and MAP, respectively, but jointly explained 28%. In the MAT gradient group, although MAP explained 22% variation in SOM composition, MAT and MAP together explained more than 51%. These results indicated that the effect of MAT alone on SOM was negligible in the MAP gradient group and MAT was the dominant influencing factor in MAT gradient group. In the MAP gradient group, SOC content and the proportion of lignin and nitrogen-containing compounds were significantly positively related to MAP. In the MAT gradient group, the proportion of aliphatic, aliphatic and terpenoid compounds was significantly positively related to MAT but the proportion of aromatic compounds was opposite. Structural equation modeling showed that MAP was significantly positively related to SOM molecular diversity and stability, and MAT was significantly negatively related to SOM stability.