This study constructs a theoretical model and empirical framework concerning how spatial structure affects economic efficiency using data on the Beijing-Tianjin-Hebei (BTH) megaregion between 2008 and 2017. The study finds the following: ① the development of the internal spatial structure of the BTH urban agglomeration is unequal. The populations of most cities in the urban agglomeration are still in a dispersed state. Although urban populations have tended to agglomerate around multiple subcenter units in the cities, the trend towards population agglomeration around city centers is not found to be significant. ② The total factor productivity (TFP) of the BTH urban agglomeration was not high in most years between 2008 and 2017, showing a fluctuating downward trend overall. The TFP of the urban agglomeration showed differential regional patterns. The decline of TFP growth in the BTH urban agglomeration is mainly due to declining technological progress, technological efficiency, and scale efficiency. Resource input remains the major driving force behind the development of the BTH megaregion. ③ Concerning how the spatial structure of the urban agglomeration affected economic efficiency, the study finds that primacy, urban Gini index, urban population size, human capital, informatization level, industrial structure, and science and technology levels have positive effects on economic efficiency, whereas dispersion, governmental role, economic openness, and land input have negative effects. This study has several policy implications. Achieving coordinated and integrated development of the BTH urban agglomeration will require constructing a scientific and regional spatial system, improving the development levels of regional central cities, divesting Beijing of noncapital functions, and reshaping the industrial layout of the BTH megaregion in an orderly manner, while continuously improving the internal hierarchical structure of urban agglomeration and strengthening intercity economic connections.