The aim of this study was to compare conventional 16S rRNA gene PCR, real-time 16S rRNA gene PCR and real-time Mycoplasma genitalium adhesin protein (MgPa) gene PCR as detection methods for M. genitalium infection. The study also determined the prevalence of M. genitalium in male and female patients attending a sexually transmitted infections clinic in a rural area in the west of Sweden. First void urine (FVU) and/or urethral swabs were collected from 381 men, and FVU and/or cervical swabs and/or urethral swabs were collected from 298 women. A total of 213 specimens were used in the PCR comparative study: 98 consecutively sampled specimens from patients enrolled in the prevalence study, 36 consecutively sampled specimens from patients with symptoms of urethritis and 79 specimens from patients positive for M. genitalium by real-time MgPa gene PCR in the prevalence study. A true-positive M. genitalium DNA specimen was defined as either a specimen positive in any two PCR assays or a specimen whose PCR product was verified by DNA sequencing. The prevalence of M. genitalium infection in men and women was 27/381 (7.1 %) and 23/298 (7.7 %), respectively. In the PCR comparative study, M. genitalium DNA was detected in 61/76 (80.3 %) of true-positive specimens by conventional 16S rRNA gene PCR, in 52/76 (68.4 %) by real-time 16S rRNA gene PCR and in 74/76 (97.4 %) by real-time MgPa gene PCR. Real-time MgPa gene PCR thus had higher sensitivity compared with conventional 16S rRNA gene PCR and had considerably increased sensitivity compared with real-time 16S rRNA gene PCR for detection of M. genitalium DNA. Real-time MgPa gene PCR is well suited for the clinical diagnosis of M. genitalium.