This story can be found in the Prose Edda. Parts are also located in the Poetic Edda in Voluspá and Grímnismál.
In the beginning there was no earth or heaven, no sand nor see nor cooling waves. There was only Ginnungagap, a great void. In the north there was Nilfheim, and from Nilfheim's spring flowed eleven rivers, known as Elivagar. As the rivers flowed south, they cooled and hardened into ice. In the south, there was the world of Muspelheim, a firey world. The northern part of Ginnungagap became filled with the ice and hoar frost from the Elivagar. When that ice formed and was firm, a drizzling rain arose from the venomous rivers and poured over the ice where it cooled into rime, and one layer of ice formed on top of the other throughout Ginnungagap. The southern part of Ginnungagap was lit by the sparks and glowing embers which flew out of Muspelheim. Where the heat from the south met the coolness in the north the ice was thawed and it began to drip and by the might that sent the heat, life appeared in the drops of the running fluid and this fluid formed into the likeness of a man. He was given the name Ymir.
As the frost continued to thaw another form was created. This form became a cow called Audhumbla. From her teats flowed four rivers of milk and it was upon this that Ymir was fed. While he fed, Ymir slept, and while he slept a male and female frost giant grew from his armpits and one leg fathered a six headed troll with the other leg.
Audhumbla lived by licking the ice-blocks which were salty, and by the evening of the first day there appeared a man's hair where she licked. On the second day, a man's head appeared, and by the third day the whole man was freed from the ice. This man was called Buri. He had a son name Bor who married Bestla, who was the daughter of the giant Bolthurn. Bor and Bestla had three sons, Odhinn, Vili, and Ve.
There was great strife between the offspring of Ymir and the children of Bor and Bestla. Odhinn led his brothers against Ymir and they killed him. Ever since that time there has been hatred and enemity between the gods and the giants.
Odhinn and his brothers dragged Ymir's body into the void. His flesh became the earth, his blood the sea. His bones became the mountains, his hair the trees, and his teeth the stones. Odhinn and his brothers discovered maggots living in what had been Ymir's flesh. They turned these into the dwarves and dark elves and these beings reside in the depths of the earth, mining the ore and minerals beneath the mountains and hills. The world of the dwarves is known as Nidavellir and the world of the dark elves is called Svartalfheim. Odhinn and his brothers also discovered some fine creatures living in the soil formed from Ymir's flesh. They named these creatures light elves and placed them in the world known as Alfheim. As Ymir's blood flowed, it created a flood that killed all the giants, save one. Bergelmir escaped with his household and they made their escape in the first boat, a hollowed out tree-trunk.
The sons of Bor then took Ymir's skull and fashioned from it the sky and set it over the earth. Under each corner they placed a dwarf and it is from the names of these dwarves that we get the directions, North, South, East and West. The sons of Bor then took the sparks and burning embers that were flying about and cast them into the midst of Ginnungagap to light the heavens and the earth. They gave stations to all the stars and planets.
They then fashioned a world for the families of giants and this world is known as Jotunheim. Away from this land they fashioned a stronghold to surround the world, to defend it from the giants. This land was fashioned from Ymir's eyebrows, and it is called Midgard. They then took the brains of Ymir and cast them into the air and these became the storm-threatening clouds.
One day while Odhinn and his brothers were walking along the sea shore they came upon two tree trunks. The gods saw great beauty in the trunks and set forth to bring them to life. Odhinn gave them soul, Vili gave motion and sense, and Ve gave being and blooming hue. These beings were the first humans and they were called Ask and Embla. Midgard was given to them to inhabit.
Once the world had been created and the gods had placed the sun and moon in the sky they made night and day. Night is a beautiful giantess with a dark complexion and hair of midnight black. Night's first husband was a man called Naglifari. Their son is called Aud. Next, Night married Annar and their daughter is called Earth. Last she married Delling and their son was Day. Odhinn then took Night and Day and gave them horses and chariots to ride across the heavens.
The sun and moon are guided across the heavens by the children of Mundilfari. They were so fair and beautiful that he called the son, Moon, and the daughter, Sun. The gods became angry at his arrogance and took the brother and sister and put them in the sky where they draw the sun and moon across the sky in chariots. They made Sun drive the horses which drew the chariot of the sun that the gods had made to light the worlds from a spark which had flown from Muspelheim. The horses which draw this chariot are called Arvak and Alsvidh. Moon is made to guide the chariot that draws the moon across the sky. This chariot is drawn by Aldsvider. Sun and Moon can never pause in their journey because they are constantly pursued by the wolves Skoll and Hati.
Now that the earth was made and had been filled with all manner of beings the gods created a home for themselves. The gods then built for themselves a stronghold in the middle of the world and it is known as Asgard. They built a bridge to connect Asgard and Midgard, and this bridge is Bifrost. Asgard is sheltered by the great world tree, Yggdrasil, which touches upon all of the worlds.