There is a relationship between spaying and prevention of mammary cancer in both the canine and feline population.
In an un-spayed (intact) female dog, 50% of tumors developed are mammary gland tumors. If a female dog is spayed before her first heat, she only has a 0.5% chance of developing mammary cancer. After the first heat, this risk increases to 8%. Once a female reaches her third heat, she has a one-in-four chance (26%) of developing mammary cancer. Spaying after the second heat does not appear to decrease the risk of mammary cancer, but may alleviate malignancy if mammary cancer does develop1.
Similar relationships are seen in cats, with those spayed before 6 months of age having a 9% risk and those spayed between 6-12 months having a 14% risk 2.
Here are some excellent links that summarize the relationship between mammary cancer and spay:

