In 217, Liu Bei led a force upon Hanzhong, which was under the control of Cao Cao. His force met with resistance led by Xiahou Yuan at Yangping Pass . The confrontation dragged on for more than a year until one night, Liu Bei set fire to the barbed fence around Xiahou Yuan's camp at the foot of Mount Dingjun. Alarmed by the attack, Xiahou Yuan sent Zhang He to defend the eastern corner of the camp, while he guarded the south. Liu Bei's main force pressed against Zhang He, outmatching the latter. Xiahou Yuan had to dispatch a fraction of his own troops to Zhang He's rescue.
Accompanied by drums, the division led by general Huang Zhong then descended upon Xiahou Yuan's dwindling force. The battle became a rout and Xiahou Yuan was killed in battle.
''Romance of the Three Kingdoms''
In chapter 71 of the historical novel The ''Romance of the Three Kingdoms'' by Luo Guanzhong, Xiahou Yuan had his camp set up on Mount Dingjun, so he can easily see the Shu camp at the bottom of the mountain. Huang Zhong moved his camp nearer and nearer to Xiahou Yuan's camp every few days.
Later, Xiahou Yuan came up with a strategy to lure Huang Zhong and capture him. He sent Xiahou Shang to Huang Zhong's camp, challenging Huang Zhong to come out and fight him. However, Chen Shi, Huang Zhong's subordinate, volunteered to fight Xiahou Shang. Xiahou Shang feigned defeat and retreated. Chen Shi would not give up and pursued Xiahou Shang, but fell into an ambush set by Xiahou Yuan and was captured. Xiahou Yuan was not very happy as he had expected to capture Huang Zhong and not some subordinate general. Later, Xiahou Shang was captured by Huang Zhong in battle.
Xiahou Yuan decided to release Chen Shi in return for Xiahou Shang, which Huang Zhong agreed. The next day, at the frontline, where the prisoners were exchanged, Huang Zhong fired an arrow at Xiahou Shang and wounded Xiahou Shang. Xiahou Yuan was furious and wanted to fight Huang Zhong but was stopped by Zhang He. Xiahou had no choice but to return to his camp and defend firmly.
At the advice of Fa Zheng, Huang Zhong moved his forces to Mount Tiandang, a nearby mountain with a higher peak. Xiahou Yuan could not tolerate Shu forces having the vantage point, and decided to attack Mount Tiandang. Huang Zhong, however, kept his forces back and did not engage the Wei troops.
Later, Fa Zheng saw that Xiahou's forces were dispirited. Fa Zheng then signaled Huang Zhong to attack Xiahou Yuan. Xiahou Yuan could not respond in time and was killed by Huang Zhong, who cleaved Xiahou right beneath the shoulders. This battle is also known as a good example in the Chinese classic ''Thirty-Six Strategies'', strategy four: "Wait at Leisure for the Exhausted Enemy". The victory consolidated Huang's position as one of the Five Tiger Generals.
The battle is also famously reenacted in the Beijing opera scene, based on the ''Romance of the Three Kingdoms''. It was said that the actor acting as Xiahou Yuan would get a red envelope for his performance during Chinese new year, since it is considered bad fortune to be "killed" on stage at that time of the year. Notably, China's first film, ''The Battle of Dingjunshan'' , was a recording of the Beijing opera depicting this battle.
The battle is one of the stages in the ''Dynasty Warriors'' for the Playstation 2. If the player is on the Shu side. Xiahou Yuan will be a prominent enemy, doubling his stats. Likewise, this is done for Huang Zhong if the player is on the Wei side.