The main army arrived at Dingjun Mountain, and Huang Zhong vaguely saw that the mountain was steep and difficult to capture quickly. Fa Zheng said: "We should first seize the terrain and hold the key points. If the enemy comes out rashly, we can attack them." Huang Zhong Following the plan, at the foot of Dingjun Mountain, by the mountain and the river, he set up camp and sent troops to challenge the enemy every day. Xiahou Yuan, relying on his bravery, wanted to go out to fight, but was advised against it by Zhang He. A few days later, Huang Zhong pretended to retreat, luring Xiahou Yuan out of camp to pursue. Xiahou Yuan indeed fell for the trick, leading his troops in a direct pursuit. Unexpectedly, Huang Zhong had set up an ambush halfway, heavily defeating Xiahou Yuan, who then retreated back to Dingjun Mountain. Huang Zhong's morale was greatly boosted, and he followed up the victory, pursuing directly to the foot of the mountain.
Fa Zheng climbed up to observe and saw that Xiahou Yuan's army had low morale and, knowing his impatience, guessed he would personally come out to supervise the battle. Then he said to Huang Zhong: "Now we should conserve our strength and wait until they are exhausted before launching an attack. I observe that Xiahou Yuan will personally come out tomorrow to repair the deer horns. General can take advantage of his unpreparedness and strike with one concerted effort!" Huang Zhong Following his advice, he kept the troops still, waiting only for the next day. The next day, sure enough, Xiahou Yuan personally came out to supervise the repair of the deer horns. At that moment, Fa Zheng saw from afar and immediately ordered Huang Zhong to attack.
Huang Zhong heard the drum, full of spirit, riding a single horse with a single blade, charging straight forward. Xiahou Yuan, caught off guard, was unable to defend himself. With a single furious shout from Huang Zhong, a flash of the blade, and Xiahou Yuan was cleaved in two. Thus Dingjun Mountain was taken by Huang Zhong. When Cao Cao heard of Xiahou Yuan's death, he was furious and personally led a large army to seize Hanzhong. Liu Bei and Zhuge Liang were fully prepared. Cao Cao repeatedly attacked without success, and with his supplies running low, the soldiers exhausted, and morale wavering. Moreover, Yang Xiu was executed by Cao Cao for seeing through the meaning of the two words "chicken ribs." In the end, Cao Cao was caught in a dilemma and had to lead his troops back to Chang'an. Thus Liu Bei gained the whole region of Hanzhong, proclaimed himself King of Hanzhong, established his administration, appointed officials, and granted titles to the Five Tiger Generals, his reputation and power shaking the realm for a time.