This is the method I used to stop one of my cats who was spraying:
First, we need to know for sure that the problem is spraying rather than urinating. If the cat is standing and the pee shoots straight back so that he/she is aiming high on the wall or side of the couch, it is spraying. If the cat squats while peeing, it is normal urination.
If the cat is peeing (not spraying) inappropriately, you need to get him or her to the vet ASAP. The #1 cause of inappropriate urination is urinary tract infections or blockages. You can also read some of the other posts on this forum for other great ideas for stopping inappropriate urination.
1. Use Feliway to help him not want to spray. Feliway mimics the friendly marking that cats do when they rub their faces on things. When a cat smells a friendly scent, they are unlikely to mark with urine. The Feliway box will give detailed instructions on how to use it....follow the instructions carefully.
2. Hang aluminum foil on the places the cat likes to spray. Cats usually will not spray on foil because it makes an unpleasant sound when hit with the urine and it makes the urine splash back on the cat. Each day that the cat does not spray a strip of foil, tear about an inch off the bottom of the foil until the foil is completely gone. Don't remove the whole strip all at once because the cat may interpret this as you saying it is okay to spray here again.
3. If you see the cat getting into the spray position, yell "No!" and then put him in time-out (in the bathroom for example) for only 2-3 minutes. Do the same if you caught him in the act.
4. Check to see if there are stray cats hanging out outside your house. A cat will often spray in response to strange cats around the house. Make sure you don't walk through outside cat spray and track that smell into the house.
5. Be patient and persistent. Breaking the spraying habit can take a while, but it should work.
p.s. The aluminum foil was the most effective thing for stopping our cat's spraying. It looks really awful having aluminum foil hanging all over the place, but it is temporary AND I'd much rather have foil on my walls than urine!