Real-time polymerase chain reaction (qPCR) was optimized for detecting Mycobacterium tuberculosis in sputum. Sputum was collected from patients (N = 112) with suspected pulmonary tuberculosis, tested by smear microscopy, decontaminated, and split into equal aliquots that were cultured in Löwenstein-Jensen medium and tested by qPCR for the small mobile genetic element IS6110. The human ERV3 sequence was used as an internal control. 3 of 112 (3%) qPCR failed. For the remaining 109 samples, qPCR diagnosed tuberculosis in 79 of 84 patients with culture-proven tuberculosis, and sensitivity was greater than microscopy (94% versus 76%, respectively, P < 0.05). The qPCR sensitivity was similar (P = 0.9) for smear-positive (94%, 60 of 64) and smear-negative (95%, 19 of 20) samples. The qPCR was negative for 24 of 25 of the sputa with negative microscopy and culture (diagnostic specificity 96%). The qPCR had 99.5% sensitivity and specificity for 211 quality control samples including 84 non-tuberculosis mycobacteria. The qPCR cost ∼5US$ per sample and provided same-day results compared with 2-6 weeks for culture.