He it is Who hath created for you all that is on earth.
Then He turned to the heaven, and made them into seven heavens. -- Sura 2:29
Sura 41:9-12 also gives details on the creation process and confirms that the earth was created first and then the heavens. But then we read also:
Are you the harder to create, or is the heaven that He built?
He raised the height thereof and ordered it;
and He has made dark the night thereof, and He brought forth the morn thereof.
And after that, He spread out the earth. -- Sura 79:27-30
Further detailed discussion of this issue:
Contradictions in the Qur'an
Answering Islam Home Page