Short answer
Muslims believe Allah alone created the heavens, the earth and everything in them from nothing, by His will and command. The Quran says He created them in six days, that the heavens and earth were once joined and then separated, and that the heaven was once smoke. The Quran does not give a full scientific timeline.
Sunni creed holds that the universe is originated (created in time) and that Allah alone is eternal, without beginning. Everything other than Allah came into being by His creating. Al-Nasafi's creed opens its account of the world by stating that it is originated in all its parts.
The four schools agree on this.
Explanation
The Prophet ﷺ said: "Allah existed and there was nothing other than Him, and His Throne was over the water. He wrote everything in the Record, and He created the heavens and the earth." Everything other than Allah, including matter, space and time, had a beginning; Allah alone has none, and He brought all of it into being.
The Quran says Allah "created the heavens and earth in six days" (7:54). Many scholars said these are not days of twenty-four hours, since the sun and its days did not yet exist, but stages known to Allah. He could have created everything in an instant, since His command is only "Be" and it is (36:82); creating in stages teaches care and order. Surah Fussilat gives more detail: the earth in two days, its mountains and provisions completed in four days in all, and the seven heavens in two (41:9-12).
The Quran also says "the heavens and the earth were a joined entity, and We separated them" (21:30), that Allah turned to the heaven "while it was smoke" (41:11), and that He is expanding it (51:47). Some Muslims see these as fitting the Big Bang. Scholars caution that the Quran is a book of guidance, so it is wise not to tie its meaning to a scientific theory that may later change. A Muslim may accept well-established science that does not contradict what the texts clearly state.
Read more in space and the universe in Islam, the seven heavens, do Muslims believe in evolution? and who created Allah?
The evidence
Quran, Surah Al-A'raaf 7:54
إِنَّ رَبَّكُمُ ٱللَّهُ ٱلَّذِى خَلَقَ ٱلسَّمَٰوَٰتِ وَٱلْأَرْضَ فِى سِتَّةِ أَيَّامٍۢ ثُمَّ ٱسْتَوَىٰ عَلَى ٱلْعَرْشِ يُغْشِى ٱلَّيْلَ ٱلنَّهَارَ يَطْلُبُهُۥ حَثِيثًۭا وَٱلشَّمْسَ وَٱلْقَمَرَ وَٱلنُّجُومَ مُسَخَّرَٰتٍۭ بِأَمْرِهِۦٓ ۗ أَلَا لَهُ ٱلْخَلْقُ وَٱلْأَمْرُ ۗ تَبَارَكَ ٱللَّهُ رَبُّ ٱلْعَٰلَمِينَ ﴿٥٤﴾
Indeed, your Lord is Allah, who created the heavens and earth in six days and then established Himself above the Throne. He covers the night with the day, [another night] chasing it rapidly; and [He created] the sun, the moon, and the stars, subjected by His command. Unquestionably, His is the creation and the command; blessed is Allah, Lord of the worlds.
States creation in six days.
Quran, Surah Al-Anbiyaa 21:30
أَوَلَمْ يَرَ ٱلَّذِينَ كَفَرُوٓا۟ أَنَّ ٱلسَّمَٰوَٰتِ وَٱلْأَرْضَ كَانَتَا رَتْقًۭا فَفَتَقْنَٰهُمَا ۖ وَجَعَلْنَا مِنَ ٱلْمَآءِ كُلَّ شَىْءٍ حَىٍّ ۖ أَفَلَا يُؤْمِنُونَ ﴿٣٠﴾
Have those who disbelieved not considered that the heavens and the earth were a joined entity, and We separated them and made from water every living thing? Then will they not believe?
Describes the heavens and earth as once joined.
Quran, Surah Fussilat 41:11
ثُمَّ ٱسْتَوَىٰٓ إِلَى ٱلسَّمَآءِ وَهِىَ دُخَانٌۭ فَقَالَ لَهَا وَلِلْأَرْضِ ٱئْتِيَا طَوْعًا أَوْ كَرْهًۭا قَالَتَآ أَتَيْنَا طَآئِعِينَ ﴿١١﴾
Then He directed Himself to the heaven while it was smoke and said to it and to the earth, "Come [into being], willingly or by compulsion." They said, "We have come willingly."
Describes the early state of the heaven.
Sahih al-Bukhari 3191
Sahih... كَانَ اللَّهُ وَلَمْ يَكُنْ شَىْءٌ غَيْرُهُ، وَكَانَ عَرْشُهُ عَلَى الْمَاءِ ...
"Allah existed and there was nothing other than Him, and His Throne was over the water."
Shows Allah alone is without beginning and created everything else.
Where the ruling is recorded
- al-Aqa'id al-Nasafiyya with Sharh al-Taftazani, Section on the origination of the world. States that the world in all its parts is originated and that its Creator is Allah, the One, the Eternal.
- al-Fiqh al-Akbar (Imam Abu Hanifa), Section on the attributes of action. States that Allah was the Creator before He created.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.