Genesis 1:3 (on the first day) And God said, Let there be light: and there was light. (KJV)
Genesis 1:14 -18 (on the fourth day) And God said, Let there be lights in the firmament of the heaven to divide the day from the night; and let them be for signs, and for seasons, and for days, and years: And let them be for lights in the firmament of the heaven to give light upon the earth: and it was so. And God made two great lights; the greater light to rule the day, and the lesser light to rule the night: he made the stars also. And God set them in the firmament of the heaven to give light upon the earth, And to rule over the day and over the night, and to divide the light from the darkness: and God saw that it was good. (KJV)
God created the sun and stars on the first day. When, on the fourth day, it says 'God made two great lights', the word used for 'made' is again 'asah', which means 'appointed' (the same way we would use it in the sentence 'they made me their leader'). On the fourth day, God appointed the sun and stars to be the dividers of day and night, and for seasons and time-telling. In the 'he made the stars also' passage, no word for 'made' really appears there (Strong's Concordance gives it the number 9999, which implies a word which is not in the original Hebrew). It's basically saying 'The stars, also'. Not a contradiction.