A genomics-based PCR method was developed and used to test specimens from patients involved in a large outbreak of Mycoplasma pneumoniae in a closed religious community in New York State. New P1 adhesin gene primers were designed to bind to 9 of 10 target sequences in the repetitive-element sequences obtained from the whole genome sequence of M. pneumoniae. This PCR method had a sensitivity of 0.006 CFU and a specificity of 100% for M. pneumoniae. The PCR was validated by testing a subset of patient samples by culture and comparing the results to those obtained by PCR. Of the initial 280 samples tested, 73 were positive by PCR and 22 were positive by culture. All samples positive by culture were also positive by PCR. Follow-up testing of selected patients 3 to 6 weeks after antibiotic treatment revealed that eight samples remained positive by PCR and that three samples remained positive by culture. Additionally, no nonspecific PCR inhibition was detected as a result of the specimen type, transport medium, or sample preparation methodology. The study demonstrates that the PCR described here is a rapid, sensitive, and specific method for the identification of M. pneumoniae and was helpful for the detection and monitoring of the outbreak.