Blockchain prevents double spending through a process called consensus mechanism. When a transaction is initiated, it is added to a block along with other transactions. Miners then compete to solve a complex mathematical puzzle to validate the block. Once the block is validated and added to the blockchain, the transaction becomes irreversible. This decentralized verification process ensures that each transaction is unique and prevents the same funds from being spent more than once.