A 51% attack occurs when an entity gains control of the majority of a blockchain's computational power, allowing them to manipulate transactions.