The incidence of Pneumocystis jirovecii pneumonia (PCP) in HIV-infected patients has decreased thanks to sulfa prophylaxis and combined antiretroviral therapy. The influence of P. jirovecii dihydropteroate synthase (DHPS) gene mutations on survival is controversial and has not been reported in Spain. This prospective multicenter study enrolled 207 HIV-infected patients with PCP from 2000 to 2004. Molecular genotyping was performed on stored specimens. Risk factors for intensive care unit (ICU) admission and mortality were identified using a logistic regression model. Seven patients (3.7%; 95% confidence interval [CI], 1.5-7.5%) had DHPS mutations. Overall mortality was 15% (95% CI, 10-21%), rising to 80% (95% CI, 61-92%) in patients requiring mechanical ventilation. None of the patients with DHPS mutants died, nor did they need ICU admission or mechanical ventilation. PaO(2) <60 mm Hg at admission was a predictor of ICU admission (P = 0.01), and previous antiretroviral therapy predicted non-ICU admission (P = 0.009). PaO(2) <60 mm Hg at admission and ICU admission during the 1st week were predictors of mortality (P = 0.03 and P < 0.001, respectively). The prevalence of DHPS mutants in Spain is low and is not associated with a worse outcome. Severe respiratory failure at admission is the strongest predictor of PCP outcome.