BACKGROUND: Community-acquired pneumonia (CAP) is a leading cause of infectious diseases and mortality. CAP is primarily treated by administration of adequate antibiotics against the causative pathogens. Because detection of some pathogens by the conventional culture method is difficult, the use of molecular diagnostic methods is increasing. Although an optimal specimen type is very important for proper testing, there is no consensus on the optimal specimen type for detecting CAP pathogens. In this study, we compared sputum specimens and nasopharyngeal aspirates (NPAs) for molecular detection of 4 CAP-causing bacterial species. METHODS: From September 2011 to January 2012, we collected sputum specimens and NPAs from CAP patients on the first or second day of hospitalization. The specimens were tested for Mycoplasma pneumoniae, Streptococcus pneumoniae, Chlamydophila pneumoniae and Legionella pneumophila by using commercial real-time PCR. RESULTS: We collected 63 sputum specimens and 96 NPAs from 109 patients and found positive results for 38.1% (24/63) and 28.1% (27/96), respectively (P = 0.251). There were no significant differences in the positive rates obtained for sputum specimens of different quality. CONCLUSIONS: The results obtained using NPAs and sputum specimens for the molecular detection of CAP pathogens were comparable.