Previous studies have related early postnatal growth with later lung function but their interpretation is limited by the methods used to assess child's growth. We aimed to assess the association of early childhood growth, measured by body mass index (BMI) trajectories up to 4 years, with lung function at 7 years.We included 1257 children from the Spanish Infancia y Medio Ambiente population-based birth cohort. Early childhood growth was classified in five categories based on BMI trajectories up to 4 years previously identified using latent class growth analysis. These trajectories differed in birth size ("lower", "average", "higher") and in BMI gain velocity ("slower", "accelerated"). We related these trajectories with lung function (forced expiratory volume in 1 s (FEV1), forced vital capacity (FVC), FEV1/FVC and forced expiratory flow at 25-75% (FEF25-75)) at 7 years, using multivariable mixed regression.Compared to children with average birth size and slower BMI gain (reference), children with higher birth size and accelerated BMI gain had higher percent predicted FVC (3.3% [95% CI: 1.0; 5.6]) and lower percent predicted FEV1/FVC (-1.5% [-2.9; -0.1]) at 7 years. Similar associations were observed for children with lower birth size and accelerated BMI gain. Children with lower birth size and slower BMI gain had lower percent predicted FVC at 7 years. No association was found for FEF25-75Independently of birth size, children with accelerated BMI gain in early childhood had higher lung function at 7 years but showed airflow limitation. Children with lower birth size and slower BMI gain in early childhood had lower lung function at 7 years.