Before the gods of the North were one family, they waged the first war of the world – against each other. The War of the Æsir and Vanir explains why there are two families of gods, how they came together – and it stands at the very beginning of time.
The North knows two families of gods: the Æsir around Odin and Thor (war, rule, law) and the Vanir around Njörd, Freyr and Freyja (fertility, sea, wealth). At the beginning they faced each other as enemies – more on this in the great pantheon article.
The war is triggered by Gullveig („gold-greed / gold-power“), a mysterious figure who comes to the Æsir. They pierce her with spears and burn her three times – and three times she rises again. She is often interpreted as an embodiment of the greed for gold, or as a Vanir goddess whose mistreatment enrages the Vanir. The first war begins, then, as so often, over gold.
„Odin hurled the spear into the host:
that was still the first war of the world.“
— Völuspá, st. 24 (after Karl Simrock, 1851, public domain)
Odin opens the war by hurling his spear Gungnir over the host of the Vanir. A long battle follows: the Vanir break the walls of Asgard with their magic, the Æsir strike back with force of arms. Neither side wins decisively. In the end both are weary of war and make peace.
As a sign of peace the two families exchange hostages. The Vanir send their best to Asgard: the sea-god Njörd and his children Freyr and Freyja – ever since they count among the highest gods of the Æsir. The Æsir in return send the wise Mimir and Hönir to the Vanir. And as a final seal both sides spit into a cauldron; from this saliva they form Kvasir, the wisest being – from whose blood the mead of poetry is later brewed. So from the first war arises poetry itself.

Æsir & Vanir – the pantheon · Njörd, Freyr & Freyja · Kvasir & the mead of poetry · Gungnir · Asgard.
Poetic Edda: Völuspá (sts. 21–24: Gullveig, the first war). Snorri Sturluson, Prose Edda (Skáldskaparmál: Kvasir, the exchange of hostages) and Ynglinga saga (the war of the Æsir and Vanir, Mimir), c. 1220. English public domain: Henry Adams Bellows (1923). Research: Rudolf Simek, Dictionary of Northern Mythology; John Lindow, Norse Mythology (2001).