Background Although cerebrospinal fluid (CSF) culture is the diagnostic reference standard for bacterial meningitis, its sensitivity is limited, particularly when antibiotics were previously administered. CSF Gram staining and real-time PCR are theoretically less affected by antibiotics; however, it is difficult to evaluate these tests with an imperfect reference standard. Methods and findings CSF from patients with suspected meningitis from Salvador, Brazil were tested with culture, Gram stain, and real-time PCR using S. pneumoniae, N. meningitidis, and H. influenzae specific primers and probes. An antibiotic detection disk bioassay was used to test for the presence of antibiotic activity in CSF. The diagnostic accuracy of tests were evaluated using multiple methods, including direct evaluation of Gram stain and real-time PCR against CSF culture, evaluation of real-time PCR against a composite reference standard, and latent class analysis modeling to evaluate all three tests simultaneously. Results Among 451 CSF specimens, 80 (17.7%) had culture isolation of one of the three pathogens (40 S. pneumoniae, 36 N. meningitidis, and 4 H. influenzae), and 113 (25.1%) were real-time PCR positive (51 S. pneumoniae, 57 N. meningitidis, and 5 H. influenzae). Compared to culture, real-time PCR sensitivity and specificity were 95.0% and 90.0%, respectively. In a latent class analysis model, the sensitivity and specificity estimates were: culture, 81.3% and 99.7%; Gram stain, 98.2% and 98.7%; and real-time PCR, 95.7% and 94.3%, respectively. Gram stain and real-time PCR sensitivity did not change significantly when there was antibiotic activity in the CSF. Conclusion Real-time PCR and Gram stain were highly accurate in diagnosing meningitis caused by S. pneumoniae, N. meningitidis, and H. influenzae, though there were few cases of H. influenzae. Furthermore, real-time PCR and Gram staining were less affected by antibiotic presence and might be useful when antibiotics were previously administered. Gram staining, which is inexpensive and commonly available, should be encouraged in all clinical settings.