Importance: Breastfeeding and exposure to ambient air pollutants have been found to be independently associated with respiratory health in children; however, previous studies have not examined the association of breastfeeding as a potential moderator of the association. Objective: To assess associations of breastfeeding and air pollution with lung function in children. Design, Setting, and Participants: Using a cross-sectional study design, children were recruited from 62 elementary and middle schools located in 7 Chinese cities from April 1, 2012, to October 31, 2013. Data analyses were conducted from November 1, 2018, to March 31, 2019. Exposures: Long-term concentrations of airborne particulate matter with a diameter of 1 μm or less (PM1), airborne particulate matter with a diameter of 2.5 μm or less (PM2.5), airborne particulate matter with a diameter of 10 μm or less (PM10), and nitrogen dioxide were estimated using a spatial statistical model matched to children's geocoded home addresses, and concentrations of PM10, sulfur dioxide, nitrogen dioxide, and ozone were measured by local air monitoring stations. Main Outcomes and Measures: Breastfeeding was defined as maternal report of having mainly breastfed for longer than 3 months. Lung function was measured using portable electronic spirometers. Using previously published predicted spirometric values for children in Northeast China as the reference, lung impairment was defined as forced vital capacity (FVC) less than 85%, forced expiratory volume in the first second of expiration less than 85%, peak expiratory flow less than 75%, or maximum midexpiratory flow less than 75%. Results: Participants included 6740 children (mean [SD] age, 11.6 [2.1] years; 3382 boys [50.2%]). There were 4751 children (70.5%) who were breastfed. Mean (SD) particulate matter concentrations ranged from 46.8 (6.5) μg/m3 for PM1 to 95.6 (9.8) μg/m3 for PM10. The prevalence of lung function impairment ranged from 6.8% for peak expiratory flow to 11.3% for FVC. After controlling for age, sex, and other covariates, 1-interquartile range greater concentration of pollutants was associated with higher adjusted odds ratios (AORs) for lung function impairment by FVC among children who were not breastfed compared with those who were (PM1: AOR, 2.71 [95% CI, 2.02-3.63] vs 1.20 [95% CI, 0.97-1.48]; PM2.5: AOR, 2.27 [95% CI, 1.79-2.88] vs 1.26 [95% CI, 1.04-1.51]; and PM10: AOR, 1.93 [95% CI, 1.58-2.37] vs 1.46 [95% CI, 1.23-1.73]). Younger age (<12 years) was associated with lower lung function impairment among the children who had been breastfed. In children from elementary schools, 1-interquartile range greater concentration of pollutants was associated with higher AORs for lung function impairment by FVC among children who had not been breastfed compared with those who had (PM1: AOR, 6.43 [95% CI, 3.97-10.44] vs 1.89 [95% CI, 1.28-2.80]; PM2.5: AOR, 3.83 [95% CI, 2.63-5.58] vs 1.50 [95% CI, 1.12-2.01]; and PM10: AOR, 2.61 [95% CI, 1.90-3.57] vs 1.52 [95% CI, 1.19-1.95]). Results from linear regression models also showed associations of air pollution with worse lung function among children who were not breastfed compared with their counterparts who were breastfed, especially for FVC (PM1: β, -240.46 [95% CI, -288.71 to -192.21] vs -38.21 [95% CI, -69.27 to -7.16] mL) and forced expiratory volume in the first second of expiration (PM1: β, -201.37 [95% CI, -242.08 to -160.65] vs -30.30 [95% CI, -57.66 to -2.94] mL). Conclusions and Relevance: In this study, breastfeeding was associated with lower risk of lung function impairment among children in China exposed to air pollution, particularly among younger children.