ABSTRACT The middle Miocene sedimentary fill of the Calatayud Basin in north-eastern Spain consists of proximal to distal alluvial fan-floodplain and shallow lacustrine deposits. Four main facies groups characteristic of different sedimentary environments are recognized: (1) proximal and medial alluvial fan facies that comprise clast-supported gravel and subordinate sandstone and mudstone, the latter exhibiting incipient pedogenic features; (2) distal alluvial fan facies, formed mainly of massive mudstone, carbonate-rich palaeosols and local carbonate pond deposits; (3) lake margin facies, which show two distinct lithofacies associations depending on their distribution relative to the alluvial fan system, i.e. front (lithofacies A), comprising massive siliciclastic mudstone and tabular carbonates, or lateral (lithofacies B) showing laminated and/or massive siliciclastic mudstone alternating with tabular and/or laminated carbonate beds; and (4) mudflat–shallow lake facies showing a remarkable cyclical alternation of green-grey and/or red siliciclastic mudstone units and white dolomitic carbonate beds. The cyclic mudflat–shallow lake succession, as exposed in the Orera composite section (OCS), is dominantly composed of small-scale mudstone–carbonate/dolomite cycles. The mudstone intervals of the sedimentary cycles are interpreted as a result of sedimentation from suspension by distal sheet floods, the deposits evolving either under subaerial exposure or water-saturated conditions, depending on their location on the lacustrine mudflat and on climate. The dolomite intervals accumulated during lake-level highstands with Mg-rich waters becoming increasingly concentrated. Lowstand to highstand lake-level changes indicated by the mudstone/dolomite units of the small-scale cycles reflect a climate control (from dry to wet conditions) on the sedimentation in the area. The spatial distribution of the different lithofacies implies that deposition of the small-scale cycles took place in a low-gradient, shallow lake basin located in an interfan zone. The development of the basin was constrained by gradual alluvial fan aggradation. Additional support for the palaeoenvironmental interpretation is derived from the isotopic compositions of carbonates from the various lithofacies that show a wide range of δ18O and δ13C values varying from −7·9 to 3·0‰ PDB and from −9·2 to −1·7‰ PDB respectively. More negative δ18O and δ13C values are from carbonate-rich palaeosols and lake-margin carbonates, which extended in front of the alluvial fan systems, whereas more positive values correspond to dolomite beds deposited in the shallow lacustrine environment. The results show a clear trend of δ18O enrichment in the carbonates from lake margin to the centre of the shallow lake basin, thereby also demonstrating that the lake evolved under hydrologically closed conditions.