In 938 CE, Ngô Quyền defeated a Southern Han fleet at the Bạch Đằng River — famously using iron-tipped stakes hidden beneath the tide — and ended the long period of northern rule. That battle is treated as the beginning of sustained Vietnamese independence.
The centuries that followed produced a series of dynasties that built the state later known as Đại Việt. The Lý dynasty (1009–1225) moved the capital to Thăng Long, today's Hanoi, and founded the Văn Miếu (Temple of Literature). The Trần dynasty (1225–1400) repelled three Mongol invasions, with Trần Hưng Đạo becoming one of the most revered figures in Vietnamese history.
The Lê dynasty followed Lê Lợi's decade-long resistance to Ming occupation in the early 15th century, and oversaw legal codification and a major southward expansion. Over centuries, Vietnamese settlement pushed south in a process called Nam tiến, absorbing Chăm territory and later the Mekong Delta — a history that is part of why Vietnam is shaped the way it is.
The Nguyễn dynasty, established in 1802 under Emperor Gia Long, unified the country under a single administration and built the imperial capital at Huế. It was the last Vietnamese dynasty; the final emperor, Bảo Đại, abdicated in 1945.

