According to Veterinarians and medical research, the best time to perform dog spay surgery is when they're six months of age, before the dog's first heat. In this case, the chances for the dog to develop mammary gland cancer is nearly zero.
Smaller breeds tend to mature a bit faster than larger breeds so many of the toy breeds are recommended to be spayed at the age of five months.