Promoting the coordinated development of green agriculture and food security is important for global sustainable development, and digital economy is a potential path to realizing this goal. Using panel data of 30 provinces (municipalities directly under the central government and autonomous regions) in China from 2014 to 2021, this study applies the entropy weight method and the coupling coordination degree model to measure the development of the digital economy and the coordination of green agriculture and food security. Moreover, the study constructs fixed-effects and spatial spillover effect models to determine the effect of the digital economy on the coordination of green agriculture and food security. We find a positive development trend between digital economy and coordination development in China, with no evident polarization phenomenon. The digital economy can effectively promote the coordinated development of green agriculture and food security, and has positive spatial spillover effects. Our findings expand the research related to the digital economy, and contribute to the promotion of sustainable agricultural development and food security.