He formed an alliance with Yan Di in later years against the invasion of Chiyou, the chieftain of the Jiuli Tribe. A decisive battle was fought at Zhuolu in the northwest of the present Hebei Province. Legend goes that at the beginning of the battle, Chiyou sneezed out a thick fog all over the place which lasted three days, and the soldiers of Huang Di could not tell their directions. Fortunately Huang Di led his men out of the fog by the "compass chariot" he had invented and won complete victory.
The alliance of Huang Di and Yan Di split after Chiyou was defeated because, it was said, Yan Di intended to infringe upon the various tribes and seize the leading position of the alliance while the chieftains of the tribes preferred to obey Huang Di. As a result the two leaders fought at Banquan. After three fierce battles, Huang Di won victory and was made the "Son of Heaven" by the tribe chieftains.
Strict and impartial, Huang Di was able to get rid of the evil for the people. It was said that Gu, son of the God of Mount Zhongshan named Zhulong, murdered another god at Mount Kunlun in collaboration with a deity called Qinpi. The Yellow Emperor was indignant at their atrocity and immediately had them killed.
The Yellow Emperor was a highly gifted "Son of Heaven". Legend goes that he was the inventor of many things such as making clothes, manufacturing boats and vehicles, building houses and palaces, etc. He also had his court officials Lun Ling make musical instruments, Da Nao compile the Heavenly Stems and the Earthly Branches*, and Cang Ji invent the Chinese characters. The country was in good order and prosperity and the people lived a happy life.
There were indeed quite a number of wars at the time, which however, broke the narrow limits between the different clans and promote (their merging. The ancient Huaxia nationality was thus gradually formed, being the predecessor of the Han nationality to which the overwhelming majority of the Chinese people belong.
It is said that Yao, Shun and the monarchs of the Xia, Shang and Zhou dynasties were all descendants of the Yellow Emperor. He was thus regarded as the first ancestor of the Chinese nation and to him was attributed the creation of all Chinese cultural institutions.