According to The Geological Society, compaction occurs when sediments are buried underneath other layers causing them to stick together due to pressure. On the other hand, cementation occurs when new minerals act as binding agents that bind the sediments together. The main difference between the two processes is that compaction brings the sediments together, and cementation binds the sediment grains together.
Compaction and cementation are prominent processes in lithification, the process of turning new, sandy sediment into hard rock formations. Lithification works to remove the air and water in the open spaces of loose, new sediment. As the process begins, both compaction and cementation work to reduce the porous space in sediment and bind the sediments together.
Compaction forces the sediments together to eliminate the open spaces within each sediment. As the sediment grains come into contact with one another, they become buried further down due to the overlying pressure.
During this process, the open pores not reduced by compaction are filled during cementation. Cementation fills the open pores with various minerals such as calcite, clay, silica and iron oxides. These minerals bind the grains together to form solid rock formations.
Not all of the pores need to be filled within these first stages of lithification because the rock can still be changed over time. Lithification is completed during the diagenesis stage.