How to Stop a Cat from Spraying?

To stop a cat from spraying, get them spayed or neutered. Usually spraying is caused by territorial instinct, but they have been known to do it because their owner has offended them in some way.