Both male and female cats mark their territory with urine. The males do it somewhat more. To make your cat behave better in this respect, you should get it neutered. Neutering has many other benefits too.
Male cats are more territorial than females and as such they are more inclined to spray territory in order to mark it as their own. A common solution to this is to neuter a male cat. Female cats are less likely to spray than males.