© 2019 by The Society for Healthcare Epidemiology of America. All rights reserved. Objective: To study the impact of duration of mechanical ventilation, hospitalization and multiple ventilation episodes on the development of pneumonia while accounting for extubation as a competing event.Design: A multicenter data base from a Spanish surveillance network was used to conduct a retrospective analysis of prospectively collected intensive care patients followed from admission to discharge.Setting: Spanish intensive care units (ICUs).Patients: Mechanically ventilated adult patients from 158 ICUs with 45,486 admissions, 48,705 ventilation episodes, and 314,196 ventilator days.Methods: Competing-risk models were applied to account for extubation plus 48 hours as a competing event for acquiring ventilator-associated pneumonia (VAP).Results: Time in the ICU before mechanical ventilation was associated with an increased VAP hazard rate and with longer intubation time. This indirect prolongation of intubation increased the cumulative risk to eventually acquire VAP. For instance, comparing 3-4 versus 0 days, the adjusted VAP hazard ratio was 1.40 (95% confidence interval [CI], 1.19-1.64) and the adjusted extubation hazard ratio was 0.64 (95% CI, 0.61-0.68), which leads to an adjusted VAP subdistribution hazard ratio (sHR) of 2.13 (95% CI, 1.83-2.50). Similarly, due to prolonged intubation, multiple ventilation episodes increase the risk for VAP; the adjusted sHR is 1.52 (95% CI, 1.35-1.72) for the second episode compared to the first episode, and the adjusted sHR is 1.54 (95% CI, 1.03-2.30) for the third episode compared to the first episode. The Kaplan-Meier method produced an upward biased estimated cumulative risk for VAP.Conclusions: A competing-risk analysis is necessary to receive unbiased risk estimates and to quantify the indirect effect of intubation time on the cumulative VAP risk. Our findings may guide physicians to improve medical decisions related to the harms and benefits of the duration of ventilation.