This article is from the Problem Behaviors in Cats FAQ, posted to rec.pets.cats newsgroup. Maintained by Cindy Tittle Moore with numerous contributions by others.
Some cats start spraying in the house. You will want to first rule out any medical causes, such as FUS or cystitis. Sometimes it is useful to distinguish between spraying (which winds up on walls) and urinating (which is generally on the floor). Spraying is more often a behavior problem and urination is more often a medical problem. It is best to check with a vet first. If the problem is medical, then you will need to simply clean up the odor after the problem is treated, otherwise you will need to try some of the behavior modification outlined below (and you'll still need to clean up the odor).
You must remove the odor from items that the cat sprayed on to prevent the cat from using the same spot again later. The ammonia smell tells the cat that this is an elimination spot, so never use ammonia to try and "remove" the odor! See (Removing Urine Odor).
Cats sometimes spray to mark their territory so sometimes an area for your cat that other animals cannot go to will help. Keeping the litterbox immaculate will help in other cases.
Sometimes cats pick small throw rugs with non-skid backing to urinate on. This is caused by an odor from the backing that somehow tells the cat to urinate there (probably an ammonia-like smell). Cat-repellent sprays or washing the rug may help; you might just have to get rid of that rug.
For persistent spraying after the above steps, try the procedure outlined in (Housetraining).