Goryeo (고려; 高麗; Koryŏ; [ko.ɾjʌ]) was a Korean kingdom founded in 918, during a time of national division called the Later Three Kingdoms period, that unified and ruled the Korean Peninsula until 1392. Goryeo achieved what has been called a "true national unification" by Korean historians as it not only unified the Later Three Kingdoms but also incorporated much of the ruling class of the northern kingdom of Balhae, who had origins in Goguryeo of the earlier Three Kingdoms of Korea. The name "Korea" is derived from the name of Goryeo, also spelled Koryŏ, which was first used in the early 5th century by Goguryeo.
The once prosperous kingdom of Later Silla, which had ruled much of the Korean Peninsula since the late 7th century, began crumbling by the late 9th century due to internal turmoil, leading to the revival of the ancient states of Baekje and Goguryeo, known in historiography as "Later Baekje" and "Later Goguryeo". Later Goguryeo, also known as Taebong, was overthrown from within in 918 by Wang Geon, a prominent general of noble Goguryeo descent, who established Goryeo in its place. Goryeo peacefully annexed Later Silla in 935 and militarily conquered Later Baekje in 936, successfully reunifying the Korean Peninsula. Beginning in 993, Goryeo faced multiple invasions by the Khitan Liao dynasty, a powerful nomadic empire to the north, but a decisive military victory in 1019 brought about a century of peace and prosperity as Goryeo entered its golden age. During this period, a balance of power was maintained in East Asia between Goryeo, Liao, and Song.
The Goryeo period was the "golden age of Buddhism" in Korea, and as the national religion, Buddhism achieved its highest level of influence in Korean history, with 70 temples in the capital alone in the 11th century. Commerce flourished in Goryeo, with merchants coming from as far as the Middle East, and the capital in modern-day Kaesong, North Korea was a center of trade and industry, with merchants employing a system of double-entry bookkeeping since the 11th or 12th century. In addition, Goryeo was a period of great achievements in Korean art and culture, such as Koryŏ celadon, which was highly praised in the Song dynasty, and the Tripitaka Koreana, which was described by UNESCO as "one of the most important and most complete corpus of Buddhist doctrinal texts in the world", with the original 81,258 engraved printing blocks still preserved at Haeinsa Temple. In the early 13th century, Goryeo developed movable type made of metal to print books, 200 years before Johannes Gutenberg in Europe.
Beginning in 1170, the government of Goryeo was de facto controlled by a succession of powerful families from the warrior class, most notably the Choe family, in a military dictatorship akin to a shogunate. During the military rule, Goryeo resisted invasions by the Mongol Empire for almost 30 years, until the ruling head of the Choe family was assassinated in 1258 by opponents in the court, after which authority was restored to the monarchy and peace was made with the Mongols; however, power struggles continued in the court and military rule did not end until 1270. From that point on, Goryeo became a semi-autonomous "son-in-law nation" of the Mongol Yuan dynasty through royal intermarriage and blood ties. Independence was regained during the reign of Gongmin in the mid 14th century, and afterward Generals Choe Yeong and Yi Seong-gye rose to prominence with victories over invading Red Turban armies from the north and Wokou marauders from the south. In 1388, Yi Seong-gye was sent to invade the Ming dynasty at Liaodong, but he turned his forces around and defeated Choe Yeong in a coup d'etat; in 1392, he replaced Goryeo with the new state of Joseon, bringing an end to 474 years of Goryeo rule on the Korean Peninsula.
The name "Goryeo" (Korean: 고려; Hanja: 高麗; MR: Koryŏ), which is the source of the name "Korea", was originally used by Goguryeo (Korean: 고구려; Hanja: 高句麗; MR: Koguryŏ) of the Three Kingdoms of Korea beginning in the early 5th century. In 918, Goryeo was founded as the successor to Goguryeo and inherited its name. Historically, Goguryeo (37 BC–668 AD), Later Goguryeo (901–918), and Goryeo (918–1392) all used the name "Goryeo". Their historiographical names were implemented in the Samguk sagi in the 12th century. Goryeo also used the names Samhan and Haedong, meaning "East of the Sea".