As a famous coastal defense heritage in the world’s military history, the maritime defense heritage of China’s Ming Dynasty represents the highest achievement of China’s ancient coastal military defense. There is a relative lack of holistic research on this defense system from its establishment to stabilization. Additionally, there is a lack of comparative research on the combination of Wokou invasions and defense patterns from a spatio-temporal perspective. The study aims to offer insights into the temporal and spatial evolution of ancient military defense heritage and investigate the significance of Ming Dynasty coastal defense. This study focuses on Zhejiang, a key coastal defense during the Ming Dynasty. Using GIS tools, it analyzes the spatio-temporal evolution characteristics of Wokou invasions and defense mode in the process of Zhejiang coastal defense from its establishment to its perfection by using GIS analytical tools, and explores the driving factors of the dynamic adjustment of this coastal defense system. The results show that: (1) Hongwu 1 to 31 (1368–1398) witnessed the construction of a 12-area defense system, encompassing Wei and Suo citadels. This followed a multi-point defense strategy, with Wei citadels controlling the coastline and Suo citadels supporting them; (2) Hongwu to Wanli (1368–1588) saw the evolution of five defense modes, evolving from decentralized to centralized and then to a coexistence of both. This culminated in the establishment of 4–6 Defense Mode (4 Canjiang and 6 Bazong); (3) the evolution of the defense paradigm is largely driven by Wokou incursions and is an adaptation from small-scale, short-duration infestations to large-scale, long-duration infestations. The findings show that the Ming Dynasty’s coastal defense system in China was flexible and adaptive, evolving to meet changing defense needs.