The Junggar Basin is one of the largest and most important oil-producing basins in China, in which Upper Permian lacustrine oil shales are among the thickest and richest source rocks in the world. The Upper Permian Pingdiquan Formation was deposited predominantly in fan-delta sequences within a lacustrine setting. In the northeastern Junggar Basin, the Pingdiquan Formation sandstones (volcanic and feldspathic litharenites) constitute the principal oil reservoirs, whereas the interbedded black shales are the predominant oil source rocks. The early diagenetic minerals in the sandstones include siderite, pyrite, analcime, albite, calcite, and trace amounts of halite. Late diagenetic minerals include K-feldspar, ankerite, and minor mixed-layer clay minerals. A similar diagenetic sequence was recognized in the intercalated mudrocks, which contain abundant analcime, albite, and microcrystalline dolomite. Early authigenic mineral formation (e.g., calcite versus analcime/albite) was controlled by alternating periods of lower and higher salinity in the lacustrine environment. Cementation by siderite, analcime, calcite, and albite substantially occluded sandstone porosity early in diagenesis. However, extensive dissolution of analcime cement and detrital feldspars during burial produced significant secondary porosity in the sandstones, improving their reservoir potential. Organic acids generated during oil-shale maturation may be responsible for secondary porosity in the interbedded sandstones.