Aim: Aspiration is a common cause of pneumonia in patients with postoperative ileus. Insertion of a nasogastric tube (NGT) is often performed, but this can be distressing. The aim of this study was to determine whether the timing of NGT insertion after surgery (before versus after vomiting) was associated with reduced rates of pneumonia in patients undergoing elective colorectal surgery. Method: This was a preplanned secondary analysis of a multicentre, prospective cohort study. Patients undergoing elective colorectal surgery between January 2018 and April 2018 were eligible. Those receiving a NGT were divided into three groups, based on the timing of the insertion: routine NGT (inserted at the time of surgery), prophylactic NGT (inserted after surgery but before vomiting) and reactive NGT (inserted after surgery and after vomiting). The primary outcome was the development of pneumonia within 30 days of surgery, which was compared between the prophylactic and reactive NGT groups using multivariable regression analysis. Results: A total of 4715 patients were included in the analysis and 1536 (32.6%) received a NGT. These were classified as routine in 926 (60.3%), reactive in 461 (30.0%) and prophylactic in 149 (9.7%). Two hundred patients (4.2%) developed pneumonia (no NGT 2.7%; routine NGT 5.2%; reactive NGT 10.6%; prophylactic NGT 11.4%). After adjustment for confounding factors, no significant difference in pneumonia rates was detected between the prophylactic and reactive NGT groups (odds ratio 1.03, 95% CI 0.56–1.87, P = 0.932). Conclusion: In patients who required the insertion of a NGT after surgery, prophylactic insertion was not associated with fewer cases of pneumonia within 30 days of surgery compared with reactive insertion.