The Ngô dynasty (Vietnamese: Nhà Ngô; Chữ Nôm: 茹吳), officially Tĩnh Hải quân (chữ Hán: 靜海軍), was a semi-independent Vietnamese dynasty from 939 to 968. The dynasty was founded by Ngô Quyền, who led the Vietnamese forces in the Battle of Bạch Đằng River against the Chinese Southern Han dynasty in 938.
Around 930, as Ngô Quyền rose to power, northern Vietnam was militarily occupied by the Southern Han and was treated as an autonomous province and vassal state of the Later Tang Dynasty, referred to as Tĩnh Hải quân. Every year the Jiedushi of Tĩnh Hải quân had to pay tribute to its Chinese master in exchange for peace and political support. At the beginning of the 10th century, China was domestically plagued and weakened by civil war during what is known as the Five Dynasties and Ten Kingdoms period. The Chinese were preoccupied with these civil struggles and lost their grip on Tĩnh Hải quân periodically. Tĩnh Hải quân took advantage of this opportunity and proclaimed its independence and seceded from China. Under the rule of Lord Protector Dương Đình Nghệ, the Tĩnh Hải quân state initiated a full blown military campaign for independence.
Southern Han (Chinese: 南漢; pinyin: Nán Hàn; Jyutping: Naam Hon; 917–971), officially Han (Chinese: 漢), originally Yue (Chinese: 越; Jyutping: Jyut6), was a dynastic state of China and one of the Ten Kingdoms that existed during the Five Dynasties and Ten Kingdoms period. It was located on China's southern coast, controlling modern Guangdong and Guangxi. The dynasty greatly expanded its capital Xingwang Fu (Chinese: 興王府; pinyin: Xìngwáng Fǔ; Jyutping: Hingwong Fu, present-day Guangzhou). It attempted but failed to annex the autonomous polity of Jinghai, which was controlled by the Vietnamese.