Stored in the public blockchain (held on every computer running the Bitcoin client) is the record of every transaction ever made, including any transactions that sent you coins. When you wish to spend your coins, you check the blockchain to find unspent coins sent to you (or mined by you).