In addition to urinating out of physiological necessity, many cats use their urine to mark their territory. This behavior is called urine spraying. Instead of squatting and urinating in a big puddle, the cat will raise his tail and squirt the urine backwards towards the object that it is trying to mark. Both males and females spray urine although the behavior is much more common in tom cats. The easiest form of treatment is to castrate the cat. In 90% of all tom cats this procedure is effective.
As a rule, cats will only start to exhibit this type of behavior when they feel their territory is threatened, such as bringing a newcomer onto the scene. Some indoor cats may feel threatened if an outdoor cat starts making himself present at the window. In this case you can and should intervene, by trying to encourage the outdoor cat to find some other type of hangout. Mothballs can be placed outside your door as a form of deterrent, but use caution when handling these because they can be harmful if eaten (children and puppies may not know any better).
Consult with your veterinarian about possible health problems which may be causing this behavior. Veterinarians have had success treating cats with drug therapy to help reduce their anxiety.