Inhaled nitric oxide improves oxygenation in severely hypoxaemic term neonates, which lessens the need for extracorporeal-membrane oxygenation. Improvement in other relevant outcomes remains unknown, and safety of inhaled nitric oxide is uncertain in preterm neonates. We did a randomised controlled trial to assess use of inhaled nitric oxide in preterm and near-term neonates. We randomly assigned 204 preterm (< 33 weeks) and near-term (> or = 33 weeks) neonates with oxygenation indices from 12.5 to 30.0 and 15 to 40, respectively, 10 parts per million (ppm) inhaled nitric oxide (n=105) or control ventilation therapy without nitric oxide (n=99). The primary endpoint was the oxygenation index at 2 h. Analysis was done by intention to treat. 12 neonates were excluded, leaving 97 (45 preterm) in the nitric-oxide group and 95 (40 preterm) in the control group. The decline in oxygenation index at 2 h was greater in the nitric-oxide group than in the control group (median 6.2 (IQR 8.4)) [corrected] vs -2.9 [12.4], p=0.005), but was significant only in near-term neonates (p=0.03). Survivors assigned nitric oxide spent fewer days on mechanical ventilation and in the neonatal intensive-care unit, but this was also significant only in near-term neonates (6 [3] vs 7 [3] days, p=0.05, and 9 [6] vs 12 [9] days, p=0.02, respectively). Low-dose inhaled nitric oxide early in the course of neonatal respiratory failure improves oxygenation and shortens duration of mechanical ventilation and the length of stay in intensive care. Inhaled nitric oxide was not, however, significantly beneficial in preterm neonates.