Cat spraying and urine marking are social, sexual and territorial behaviors. It's also how cats express extreme emotions such as frustration. Your cat is trying to tell you sometime. The primary cause of the spraying is your cat's insecurity in his territory.
First, is he neutered? Generally, neutering prevents or stops spraying behavior in a cat, but it's not a 100% solution. Is your cat healthy? Have there been any social changes, like a roommate moving in or out? Is there a new cat or dog in the neighborhood that he perceives as a rival or threat? Is your cat being inadvertently "mistreated" in any way? Does your cat feel neglected?
Has your schedule and therefore his routine changed drastically? Are you "seeing another cat" outside your home and bringing back its scent on your clothing? Moving into a new home or changes in the environment can cause a cat to spray. Previous occupants of your new home may have had a cat and your cat may be reacting to the smells that cat left behind.
All these things can cause a cat to spray or urine mark. Many people don't realize it, but both male and female cats can urine mark. Again, and I cannot emphasize this enough, the primary cause of spraying is your cat's insecurity in his territory. Help your cat increase his confidence and feeling of security. Give him tons of praise, affection and attention for simply breathing. Constantly reassure him that he is the most wonderful cat in the world. Play with him, massage him, talk to him, do everything to rebuild his self esteem.
When cats spray windows, doorways, fireplaces or any area where outside smells can enter your home, it's a sure sign that something out there is provoking it. It can be a tomcat, a female cat in season, maybe even a dog. Close off the windows so your cat can't see out. Maybe even just the sight of a perceived rival or threat is causing him to spray. In addition, place a few drops of your favorite perfume or aftershave by the window to mask out any scent that may be entering through the window. At the same time, your cat needs his confidence and security reinforced. Pay extra special attention to him and under no circumstance reprimand him for spraying behavior. You will only add stress to stress and worsen the problem. What your cat needs is reassurance and a sense of security from you, not your scorn.