There are actually two problems:
Cats mark because they're excited - either positively or negatively - for a variety of reasons.
Pheromones are natural chemicals secreted at various locations on the animal's body that communicate with other members of a species to affect their behavior. They're the key to feline marking and scratching behavior.
Marking spots are characteristically found on walls, corners, furniture, and other prominent objects in the house, approximately 8 inches above the ground or floor - where it can be easily perceived by other cats.
In marking, the cat follows a prescribed behavior pattern. He or she chooses a spot - kneads the ground/floor with increasing excitement - backs up to the target - and with the tail held vertically, sprays a horizontal jet of urine.
BOTH MALE AND FEMALE CATS MARK - including a percentage of spayed and neutered animals.
Scratching is largely territorial behavior. Like urine marking, it's found primarily on vertical surfaces. It leaves both visible and pheromonal evidence of the cat's presence as a warning to other cats.
See Feliway Spray for an end to marking and scratching.