The study on the Zhangjialiang No. 2 coal of Middle Jurassic Yan'an Formation in the northeastern Ordos Basin has been analyzed by gas chromatography-mass spectrometry (GC-MS) to determine geochemical characteristics and reconstruct palaeovegetation and palaeoclimate changes. The distribution of n-alkanes is mainly unimodal, with a medium and high molecular weight. Pr/Ph ratio (2.03–10.6) is high in most samples. The values of Tm/Ts ratio are between 1.42 and 4.92, and a predominance of C29 over C27 steranes has been found for the analyzed samples. These parameters indicate that all samples were deposited in an oxidizing freshwater environment, and the organic matter was mainly derived from terrestrial higher plants, with a small amount of aquatic organisms. Thermal maturity parameters such as C3122S/(22S + 22R) homohopane, C30αβ/(αβ + βα) hopane, together with the total organic carbon (TOC) contents (43.1% - 58.6% (except floor 2-13)) and the detected of C2717β(H)-22, 29, 30-trisnorhopane (βTm), suggest that most of samples have a relatively low maturity in the early stage. Besides, gymnosperm-derived biomarkers, including labdane, norpimarane, isopimarane, phyllocladane, abietane, rimuane, ent-beyerane, ent-kaurane, suggest that the vegetation during the Middle Jurassic Yan’an Formation was characterized by conifers.