This section needs additional citations for verification
. (November 2013)
In the Spring and Autumn period (722–403 BC), the state of Jin was located in what is now Shanxi Province. It underwent a three-way split into the states of Han, Zhao and Wei in 403 BC, the traditional date taken as the start of the Warring States period (403–221 BC). By 221 BC, all of these states had fallen to the state of Qin, which established the Qin Dynasty (221–206 BC).
The Han Dynasty (206 BC – AD 220) ruled Shanxi as the province of Bingzhou. During the invasion of northern nomads in the Sixteen Kingdoms period (304–439), several regimes including the Later Zhao, Former Yan, Former Qin, and Later Yan continuously controlled Shanxi. They were followed by Northern Wei (386–534), a Xianbei kingdom, which had one of its earlier capitals at present-day Datong in northern Shanxi, and which went on to rule nearly all of northern China.
The Tang Dynasty (618–907) originated in Taiyuan. During the Tang Dynasty and after, present day Shanxi was called Hédōng (河東), or "east of the (Yellow) river". Empress Wu Zetian, China's only female ruler, was born in Shanxi in 624.
During the first part of the Five Dynasties and Ten Kingdoms period (907–960), Shanxi supplied rulers of three of the Five Dynasties, as well as being the only one of the Ten Kingdoms located in northern China. Shanxi was initially home to the jiedushi (commander) of Hedong, Li Cunxu, who overthrew the first of the Five Dynasties, Later Liang (907–923) to establish the second, Later Tang (923–936). Another jiedushi of Hedong, Shi Jingtang, overthrew Later Tang to establish the third of the Five Dynasties, Later Jin, and yet another jiedushi of Hedong, Liu Zhiyuan, established the fourth of the Five Dynasties (Later Han) after the Khitans destroyed Later Jin, the third. Finally, when the fifth of the Five Dynasties (Later Zhou) emerged, the jiedushi of Hedong at the time, Liu Chong, rebelled and established an independent state called Northern Han, one of the Ten Kingdoms, in what is now northern and central Shanxi.
Shi Jingtang, founder of the Later Jin, the third of the Five Dynasties, ceded a piece of northern China to the Khitans in return for military assistance. This territory, called The Sixteen Prefectures of Yanyun, included a part of northern Shanxi. The ceded territory became a major problem for China's defense against the Khitans for the next 100 years, because it lay south of the Great Wall.
The later Zhou, the last dynasty of the Five Dynasties period was founded by Guo Wei, a Han Chinese, who served as the Assistant Military Commissioner at the court of the Later Han which was ruled by Shatuo Turks. He founded his dynasty by launching a military coup against the Turkic Later Han Emperor, however his newly established dynasty was short lived and was conquered by the Song Dynasty in 960.
Pagoda of Fogong Temple built in 1056
In the early years of the Northern Song Dynasty (960–1127), the sixteen ceded prefectures continued to be an area of contention between Song China and the Liao Dynasty. Later the Southern Song Dynasty abandoned all of North China, including Shanxi, to the Jurchen Jin dynasty (1115–1234) in 1127 after the Jingkang Incident of the Jin-Song wars.
The Mongol Yuan Dynasty divided China into provinces but did not establish Shanxi as a province. Shanxi only gained its present name and approximate borders during the Ming Dynasty (1368–1644) which were of the same landarea and borders as the previous Hedong Commandery that existed during the Tang Dynasty. During the Qing Dynasty (1644–1911), Shanxi extended north beyond the Great Wall to include parts of Inner Mongolia, including what is now the city of Hohhot, and overlapped with the jurisdiction of the Eight Banners and the
Guihua Tümed banner in that area.
With the collapse of the Qing dynasty, Shanxi became part of the newly established Republic of China. During most of the Republic of China's period of rule over mainland China (1912–1949), the warlord Yan Xishan controlled Shanxi. Yan Xishan devoted himself to modernizing Shanxi and developing its resources during his reign over the province. During the Second Sino-Japanese War, Japan occupied much of the province after winning the Battle of Taiyuan. Shanxi was also a major battlefield between the Japanese and the Chinese communist guerrillas of the Eighth Route Army during the war. The soldiers of Shanxi province under Yan Xishan viciously fought against the invading Japanese, which impressed the Japanese to say that nowhere in China did people fight so heroically and bravely.
Right after the defeat of Japan, much of the Shanxi countryside became important bases for the communist People's Liberation Army in the ensuing Chinese Civil War. Yan had incorporated thousands of former Japanese soldiers into his own forces to fight against the communists, and these soldiers became part of his failed defense of Taiyuan against the People's Liberation Army in early 1949. Shanxi was eventually conquered by the communists, resulting in the warlord Yan Xishan's retreat to Taiwan Island. In September, Shanxi Provincial People's Government was established.
For centuries, Shanxi served as a center for trade and banking; the "Shanxi merchants" were once synonymous with wealth. The well-preserved city and UNESCO World Heritage site Pingyao shows many signs of its economic importance during the Qing dynasty. During modern times, coal mining is important to Shanxi's economy, however critics have complained of deplorable mine conditions.
Since 2004 the province have been plagued with labour safety issues, including a slave labour scandal involving children, causing significant civil unrest and national embarrassment, leading to reforms by the communist government.