If your cat is not spayed or neutered, doing so can be an effective way to eliminate spraying. A vast majority of cats, both male and female, will stop spraying within a couple weeks of being sterilized. If spaying or neutering is not an option, first figure out why your cat is spraying and try to remove the cause.
For example, if your cat gets upset by the presence of another cat in his territory, try to make it so the cat cannot gain entrance to the disputed area. If the reaction started when you introduced a new family member, such as another cat, you may want to consider finding a different home for the new cat, or try encouraging better behavior in the offending cat by offering treats as a reward for getting along.
When removing the source of the problem or trying positive reinforcement does not help, you may need to use medication to calm your cat, which can prevent him from feeling the need to spray. Talk with your veterinarian to discuss the best options.
If caught early enough, spraying can often be eliminated by removing the source of your cat’s stress or through positive reinforcement.