Introduction Very preterm birth is associated with lung function impairment later in life, but several aspects have not been studied. We aimed to comprehensively assess lung function at school age in very preterm infants and term controls, with special emphasis on bronchopulmonary dysplasia (BPD), sex and bronchodilator response. Methods At 12 years of age, 136 children born very preterm (85 with and 51 without BPD), and 56 children born at term performed spirometry, body plethysmography, impulse oscillometry, measurement of diffusion capacity and multiple breath washout, before and after bronchodilator inhalation. Results Airway symptoms and a diagnosis of asthma were more common in children born very preterm. These children had more airflow limitation, seen as lower FEV 1 (p<0.001), FEV 1/FVC (p=0.011) and FEF 25-75 (p<0.001), and a higher total and peripheral airway resistance compared to term born controls. There was no difference in total lung capacity, but air trapping and lung clearance index were higher in children born very preterm. Diffusion capacity was lower in children born very preterm, especially in those with a diagnosis of BPD. In most other tests, the differences between preterm-born children with or without BPD were smaller than between children born preterm versus at term. Boys born preterm had more lung function deficits than preterm born girls. In children born very preterm, airway obstruction was to a large extent reversible. Conclusion At 12 years of age, children born very preterm had lower lung function than children born at term in most aspects. Airway obstruction improved markedly after bronchodilator inhalation, and there was only little difference between children with or without BPD.