To investigate the association between erectile dysfunction and fibromyalgia, and to clarify related comorbidities and treatment modalities. This retrospective cohort study was carried out using 1million records in the National Health Insurance Research Database. From 2001 to 2012, a total of 53678 male patients newly diagnosed with fibromyalgia were recruited as the fibromyalgia cohort, and the same number of the non-fibromyalgia cohort was enrolled and matched with propensity score with age, income, comorbidities, and prescribed medications. All records were followed up until the end of 2013. The Cox proportional hazards model was carried out to assess the risk of erectile dysfunction among fibromyalgia patients. The incidence rates of erectile dysfunction were 36.86 and 21.15 (per 10000 person-years) in the fibromyalgia and non-fibromyalgia cohorts, respectively, and a significantly increased risk of erectile dysfunction in fibromyalgia patients was noted (adjusted hazard ratio 1.69, 95% confidence interval 1.55-1.85, P<0.001). The Cox proportional hazards regression analysis showed increased risk of erectile dysfunction in the fibromyalgia cohort regardless of treatment prescriptions of tramadol, antidepressants, gabapentin and non-steroidal anti-inflammatory drugs. Fibromyalgia was found to be an independent risk factor for the incidence of erectile dysfunction.