When you spoil something, you destroy it or ruin its quality. If you spoil a surprise, you tell the secret you were supposed to keep.
When you spoil something, you mess it up, like spoiling someone's good mood by bringing up a painful memory. Food can also spoil, or become unsafe for eating, and you can spoil a child by always giving him everything he wants, making him unable to cope when things don't go his way. The word spoil comes from the Old French espoillier, to plunder. In fact, things taken by force are called spoils, like the spoils of war.