Ways to control territorial cat spraying include neutering or spaying your cat, restricting her exposure to the outdoors, playing with her more, and paying extra attention to cats in multi-cat households. It's also helpful to keep a routine, maintain cleanliness and use repellent sprays.
Spraying is different from urination. Whereas a cat urinates on horizontal surfaces, and doing so outside the litter box may indicate a urinary tract infection, a cat marks territory by spraying on vertical surfaces. Both male and female cats spray, but the behavior is more common in households in which there are nonneutered males, multiple cats, major changes or conflict between cats.