Sayyiduna Imran bin Husayn (may Allah be pleased with him) said: I went to the Messenger of Allah (peace and blessings be upon him). Then he narrated the hadith, and in it the wording was that they said: "We have come to ask you about the creation of the world." He (peace and blessings be upon him) said: "There was Allah, and there was nothing other than Him; His Throne was upon the water; He wrote everything in the Preserved Tablet, and He created the heavens and the earth."
Imam al-Bukhari (may Allah have mercy on him) recorded this hadith in his Sahih from Umar bin Hafs bin Ghiyath. What is meant by it, and Allah knows best, is: then He created the water, created the Throne upon the water, created the Pen and commanded it to write, and then it wrote everything in the Preserved Tablet.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السير / 17702