We developed a simple and rapid method for DNA extraction from sheep milk to use for polymerase chain reaction (PCR) diagnosis of Mycoplasma agalactiae. We tested 357 samples from 21 newly infected flocks (group 1) and 87 samples from 8 flocks infected in the past (group 2). PCR results were compared with those of conventional culture. By PCR we detected 175 positives in group 1, while by culture we detected only 153. Milk samples from group 2 were negative, both by PCR assay and by culture. Our PCR is much faster than culture and reduces the time required for diagnosis from several days to 5 h. The method could be used for the routine diagnosis of contagious agalactia caused by Mycoplasma agalactiae.