Yield gap (Yg) analysis is useful to map the scope for sustainable intensification of agriculture, but explaining and quantifying the underlying causes of yield gaps remains a considerable challenge. The objective of this study was to decompose maize yield gaps under different nitrogen (N) application rates and soil quality conditions across irrigated and rainfed cropping systems in China. A comprehensive database consisting of 5228 on-farm trials located in three major maize production regions of China was used for this purpose. The on-farm trials contained detailed information for four different treatments: fertilizer omission (control), optimal N rate (optimal N), 50% of optimal N rate (low N) and 150% of optimal N rate (high N). These were combined with biophysical and yield potential data from the Global Yield Gap Atlas (http://yieldgap.org). An analytical framework integrating stochastic frontier analysis and principles of production ecology was applied to decompose the overall maize yield gap into components of efficiency (and respective management and soil quality effects, Yg-M and Yg-S), resource (Yg-R), and technology Yg (Yg-T). The potential yield (Yp) of irrigated maize averaged 14.5 Mg/ha in Northeast China (NE) and 11.9 Mg/ha for North China Plain (NCP), and the water-limited potential yield (Yw) of rainfed maize averaged 12.0 Mg/ha in NE and 10.5 Mg/ha in Southwest China (SW), respectively. Maize yield gaps were highly variable across N treatments and cropping systems and ranged between 27–56% of Yp or Yw. Larger absolute yield gaps were observed in irrigated cropping systems in NE (4.8–8.1 Mg/ha) than in NCP (3.8–6.1 Mg/ha) and in rainfed cropping systems in NE (3.6–6.7 Mg/ha) and SW (2.8–5.9 Mg/ha). The components of the yield gap differed in size across cropping systems and N treatments. Yg-T was fairly small and consistent across N treatments ranging between 7.0% and 12.0% of Yp for irrigated maize and only ca. 2.0% of Yw for rainfed maize in NE. Yg-R was strongly associated with the N treatment explaining between 16.0–26.0% of Yp (or Yw) for control and low N treatments and being close to negligible for the optimal and high N treatments. Yg-M due to inefficient crop management accounted for 6.0–14.0% of Yp (or Yw) across cropping systems and N treatments, which is equivalent to 0.7–1.8 Mg/ha. The Yg-S explained the largest proportion of the total yield gap, especially in trials with low and medium soil quality levels, accounting for 11.0–24.0% of Yp or Yw (1.3–3.1 Mg/ha). The Yg-S was linked to partly manageable soil properties, such as low soil organic matter contents and low available P and/or K. This study is one of the first to incorporate the effects of soil quality in yield gap analysis and provides a basis to target management practices that can improve soil quality and N use efficiency while narrowing maize yield gaps in China.