The word 'said' is being translated from the Hebrew word אמר ('amar), which means, according to the lexicon, 'to say, to answer, to say in one's heart, to think, to command, to promise, to intend.' Who is God speaking to here?The use of the word 'said' prior to His statement is allegorical. We can see here that the Supreme Being is making an intention, followed by an execution: 'Let there be light' is directly followed by and there was light.
God saw that the light was good, and He separated the light from the darkness. And God said, 'Let there be light,' and there was light.