This work investigated the mineralogy and geochemistry of the No. 3 coal seam in Permian Shanxi Formation in Guotun Mine, Juye Coalfield, north China, in order to understand the genesis of the minerals and the enrichment of trace elements. Approaches used were optical microscopy and electron probe microanalysis for minerals, X-ray fluorescence analysis for major elements and inductively coupled plasma mass spectrometry analysis for trace elements. The coal is comprised of dominant kaolinite and calcite, the claystone is characteristic of major kaolinite, montmorillonite, and proportional illite, and the sandstone contains mainly quartz and chalcedony, and a relative amount of feldspar and kaolinite. These minerals were derived dominantly from the weathered source rocks with volcanic and granitic constituents in the pre-diagenetic period, and minor from the hydrothermal deposit in the epigenetic period. The claystone is relatively enriched in Li, Cs, Be, Nb, Mo, U, Th, V, In, Pb, Bi, and Se, which may probably be controlled by the source rocks and the specific sedimentary environment. The enriched trace elements are mostly associated with minerals. Li may probably occur in montmorillonite and illite, while In, Pb, Bi, and Se occur mainly in selenio-galena.