The veterinary community is in general agreement that early spaying is the best:
The risk of malignant mammary tumors in dogs spayed prior to their first heat is 0.05%. It is 8% for dog spayed after one heat, and 26% in dogs spayed after their second heat. Mammary Tumors (Cancer) in Dogs