God says in the Quran:
He is the one who created the skies and the Earth... [57:4]When God says He created Earth, some people think it means He picked up a handful of gravel and put them into a ball that became Earth. This is a very simpleminded way of understanding God's words; there is a much more elegant explanation. Atheism's favorite personality Carl Sagan says:
If you want to make an apple pie from scratch, you must first create the universe.
Atheists have been repeating the above statement for years, never realizing that it gets dangerously close to providing an explanation for God's way of creating things, an explanation that's perfectly consistent with science, and that defeats a lot of atheism's arguments against religion.
To mirror Sagan's saying:
When God wants to create Earth from scratch, He first creates the Big Bang
...in a way that results in one particular planet with Earth's life-supporting properties to come into existence, to circle around a star with the Sun's properties, and to be surrounded by the rest of the astronomical bodies in the Solar System and beyond.
God planned the creation of today's Earth millions, maybe billions, of years ago, before the universe even existed. He calculated the laws of physics necessary for Earth to exist, and with the Big Bang He put His plans into motion, which ultimately led to the creation of the Earth, with the exact location in the universe, and the exact physical properties, that He planned for it from before the Big Bang.
Creating Earth in this indirect manner requires vastly more knowledge, precision, elegance, and top-notch engineering than the typical boring religious explanation suggests.
This post does not explain how God created the Big Bang. Either science will discover more about how God did it (the same way it has discovered some of the secrets of how God set up His system for generating rain on Earth), or it is not possible to figure out from inside the universe what went on outside of it.