The urban agglomeration (UA), as the carrier of regional economic transformation, is an important impetus for the development of the digital economy (DE) in the future. Based on the perspective of the spatial structure of UA, this paper first attempts to clarify the theoretical aspects of the influence of the spatial structure on DE, its heterogeneous characteristics, and inner impact mechanism, and then empirically test the corresponding hypotheses by utilizing the data on China’s 18 UAs from 2011 to 2019. Our findings are as follows: (1) The monocentric structure has an inverted “U-shaped” impact on DE, namely, first promotion and then inhibition effects. (2) Heterogeneity analysis reveals that the inverted “U-shaped” relationship between the monocentric structure and DE is not observed in UAs lacking megacities and is insignificant during the early and middle development phases of UAs. However, this non-linear relationship becomes significant in UAs with megacities and UAs in mature and later development stages. (3) More deeply, this study uncovers that innovation serves as a mediating factor in the influence of the monocentric structure on DE. This article not only enriches the existing body of research on UAs and DE but also provides valuable theoretical insights for the development of DE within UAs.