Actually the "earth" (h'rts) is described in Genesis 1:2 as thwwbhw, a hendiadys expression based on thw "nothingness" (cf. 1 Samuel 12:21; Job 26:7; Isaiah 29:21, 40:17, 41:23, 44:9, 49:4), so basically the idea is "the earth had been in a state of confused non-existence", not just that the earth was "shapeless" (which Westerman points out is not quite accurate). The LXX translates as "invisible and not yet in order" which suggests a confused mingling of disordered and unformed elements in darkness in a state of chaos. Thw can also mean "desert" which carries through the idea of devastation and loss of order, but this is not appropriate since the 'rts is in the midst of the thm "watery deep". That the conception in Genesis 1:2 corresponds to ANE, and specifically Canaanite, creation myths, consider the following passage from Philo of Byblos, presenting the Phoenican creation story:
"At the beginning of everything there was darkness and a strong wind or darkness and a whining wind and a black slimy chaos. It was unordered and undefined and remained so for an age" (Philo of Byblos, PE, cited in Westerman, p. 104)
The notion of darkness preceding everything can be found in Greek, Egyptian, and Babylonian creation myths. In the OT, darkness is also coupled with thw "nothingness, waste" in Isaiah 45:19, Jeremiah 4:23, and with thm "watery deep" in Psalm 88:7; Isaiah 5:30, and with Sheol in Job 17:13. As a place of darkness, the deep, and nothingness, Sheol remains in an uncreated state. Regarding the separation of light and darkness, this is a motif from cosmogonies of division and the separation also sets in motion the march and rhythm of time, the time-cycle of night and day. To talk about this as setting the earth rotating on its axis is to read modern concepts into an ancient narrative that had no such concept. The light mentioned here is not illumination from the sun, which was not created until 1:14-18.