Trace elements of the No. 9 coal seam from Aanjialing mine were measured by ICP–MS. The results indicated that Li, Ga, Cr, Sr, Zr and Pb are significantly enriched in the No. 9 coal seam. The Li and Ga contents in most of the coal seam samples reached an economically valuable level. Most trace elements were enriched near the roof and floor. The data from the Sr/Ba, V/Zn, Th/U, V/Zr and V/Ni ratios reveal that during this period, the peat swamp from this area was formed in swamp water, which was influenced by sea-water or, in an sea-land transition environment, where the ancient water salinity was slightly high. The Eu negative anomaly obviously shows that the rare earth elements are consistent with the terrigenous rocks, so we deduced that the rare earth elements contained in the mineral may mainly come from terrestrial detritus.