To enable this, the blockchain uses a merkle tree to organize the transaction records in such a way that client software can locally delete portions of its own database it knows it will never need, such as earlier transaction records of Bitcoins that have changed ownership multiple times.
https://en.bitcoin.it/wiki/Bitcoin#ConfirmationsAFAIK, however, this is still unimplemented in the main Bitcoin client. But at least a solution is known.