The diagnosis of hospital-acquired pneumonia remains challenging. We hypothesized that analysis of volatile organic compounds (VOCs) in exhaled breath could be used to diagnose pneumonia or the presence of pathogens in the respiratory tract in intubated and mechanically-ventilated intensive care unit patients. In this prospective, single-centre, cross-sectional cohort study breath from mechanically ventilated patients was analysed using gas chromatography-mass spectrometry. Potentially relevant VOCs were selected with a p-value < 0.05 and an area under the receiver operating characteristics curve (AUROC) above 0.7. These VOCs were used for principal component analysis and partial least square discriminant analysis (PLS-DA). AUROC was used as a measure of accuracy. Ninety-three patients were included in the study. Twelve of 145 identified VOCs were significantly altered in patients with pneumonia compared to controls. In colonized patients, 52 VOCs were significantly different. Partial least square discriminant analysis classified patients with modest accuracy (AUROC: 0.73 (95% confidence interval (CI): 0.57–0.88) after leave-one-out cross-validation). For determining the colonization status of patients, the model had an AUROC of 0.69 (95% CI: 0.57–0.82) after leave-one-out cross-validation. To conclude, exhaled breath analysis can be used to discriminate pneumonia from controls with a modest to good accuracy. Furthermore breath profiling could be used to predict the presence and absence of pathogens in the respiratory tract. These findings need to be validated externally.