Background: Residing in greener areas is increasingly linked to beneficial health outcomes, but little is known about its effect on respiratory health.Objective: We examined associations between residential greenness and nearby green spaces with lung function up to 24 years in the UK Avon Longitudinal Study of Parents and Children (ALSPAC) birth cohort.Methods: Lung function was measured by spirometry at eight, 15 and 24 years of age. Greenness levels within circular buffers (100-1000 m) around the birth, eight-, 15- and 24-year home addresses were calculated using the satellite-derived Normalized Difference Vegetation Index and averaged (lifetime greenness). The presence and proportion of green spaces (urban green spaces, forests and agricultural land) within a 300 m buffer was determined. First, associations between repeated greenness and green space variables and repeated lung function parameters were assessed using generalized estimation equations (N = 7094, 47.9% male). Second, associations between lifetime average greenness and lifetime average proportion of green spaces with lung function at 24-years were assessed using linear regression models (N = 1763, 39.6% male). All models were adjusted for individual and environmental covariates.Results: Using repeated greenspace and lung function data at eight, 15 and 24 years, greenness in a 100 m buffer was associated with higher FEV1 and FVC (11.4 ml [2.6, 20.3] and 12.2 ml [1.8, 22.7], respectively, per interquartile range increase), as was the presence of urban green spaces in a 300 m buffer (20.3 ml [-0.1, 40.7] and 23.1 ml [-0.3, 46.5] for FEV1 and FVC, respectively). These associations were independent of air pollution, urbanicity and socio-economic status. Lifetime average greenness within a 100 m buffer and proportion of agricultural land within a 300 m buffer were associated with better lung function at 24 years but adjusting for asthma attenuated these associations.Discussion: This study provides suggestive evidence that children whose homes are in more vegetated places or are in close proximity of green spaces have better lung function up to 24 years of age.