The Lower Eocene shallow marine Roda Sandstone Member forms part of the Paleogene fill of the Tremp–Graus Basin in the southern Spanish Pyrenees. It is composed of mixed siliciclastic–carbonate sandstones that were severely modified in composition and texture shortly after deposition during pauses in sedimentation. Moreover, part of the sand was lithified by an early marine fringe cement. This early diagenetic cement stabilized the sandstone framework and prevented mechanical compaction. Where early cement was absent, mechanical compaction severely reduced the primary porosity during a first burial phase. Ductile grains were squeezed between rigid grains, obstructing pore connections. This caused the development of distinct porosity patterns in the sandstone bodies. After the first burial phase, two major phases of uplift and erosion resulted in the truncation of the Roda Sandstone Member in the northern part of the area studied. After the erosional phases, the sandstones were buried again. Recharge of the sandstone bodies with fresh water caused replacement of aragonite and high–magnesian calcite by low–magnesian calcite. Simultaneously, a second generation of sparry calcite cement was precipitated. Replacement and cementation were completed first in the most porous and permeable levels represented by those parts of the sandstone that contained the early cement. The intervals compacted during the first burial were cemented later or cementation was completed later.