The rapid expansion of China's urban agglomerations in recent decades has resulted in over-occupied ecological spaces and increased ecological pressure that are restricting healthy regional development. This paper examines the structure and characteristics of distribution of "production-living-ecological" spaces in five mega-urban agglomerations in China: Beijing-Tianjin-Hebei (BTH), the Yangtze River Delta (YRD), Guangdong-Hong Kong-Macao Greater Bay Area (GBA), Chengdu-Chongqing (CY), and the middle reaches of the Yangtze River (MYR). We analyze spatial and temporal variations in the ecological spaces and factors influencing them from 1990 to 2020, and examine the comprehensive ecological carrying capacity and status of ecological spaces in the past 30 years based on the available water resources, regulation of water and air quality, and leisure and recreation. The results show the following: (1) Urban agglomerations in different stages of formation and development represent varying area ratios of "ecological-production-living" spaces. The modes of expansion and evolution of the living spaces are dominated by multi-center combinations as well as the spatial structure of ecological spaces, including barrier, compact, discrete, and fully enveloping spaces. (2) From 1990 to 2020, the area occupied by living spaces in urban agglomerations continued to increase significantly while that of spaces for ecological production decreased. Except in the GBA, ecological spaces have exhibited a trend of increase in area, especially in the past 10 years. The area ratios and spatio-temporal variations in the "production-living-ecological" spaces indicate that the main functions of production and ecological spaces in mega-urban agglomerations have shifted from supply to regulation and culture, and reflect the transition from rapid urbanization to sustainable urbanization in China. (3) The comprehensive ecological carrying capacities of 78.6%, 73.1%,