According to the revelations received by the Prophet Joseph Smith, all things were created spiritually before they were created naturally upon the earth. There is an eternal part of man that has always existed known as intelligence. Intelligence combined with spirit matter creates that which is spirit. Spirit matter is still matter but it is of a more pure or fine matter that cannot be seen by the natural eye of man. After the spiritual creation of man, he is born into this world with a more coarse matter which is what we have now. It originated from this earth as Adam was created from the dust of the earth. All mankind will eventually resurrected because of the atonement of Jesus Christ. It is then that we will receive an immortal body of flesh and bones.
Man, however, was not the only creature that was created spiritually. All the animals and plants and even the earth itself was created spiritually before it was created naturally and it is believed that all of God's creations contain a portion of eternal intelligence. It is because of there being intelligence in all things that God is able to speak unto mountains and they can move. Or he curses a fig tree and it dies.
Moses 3:5
5 And every plant of the field before it was in the earth, and every herb of the field before it grew. For I, the Lord God, created all things, of which I have spoken, spiritually, before they were naturally upon the face of the earth. For I, the Lord God, had not caused it to rain upon the face of the earth. And I, the Lord God, had created all the children of men; and not yet a man to till the ground; for in heaven created I them; and there was not yet flesh upon the earth, neither in the water, neither in the air;
Doctrine and Covenants 93:29
29 Man was also in the beginning with God. Intelligence, or the light of truth, was not created or made, neither indeed can be.
Doctrine and Covenants 131:7-8
7 There is no such thing as immaterial matter. All spirit is matter, but it is more fine or pure, and can only be discerned by purer eyes;
8 We cannot see it; but when our bodies are purified we shall see that it is all matter.
Genesis 2:7
7 And the Lord God formed man of the dust of the ground, and breathed into his nostrils the breath of life; and man became a living soul.
Jacob 4:6
6 Wherefore, we search the prophets, and we have many revelations and the spirit of prophecy; and having all these witnesses we obtain a hope, and our faith becometh unshaken, insomuch that we truly can command in the name of Jesus and the very trees obey us, or the mountains, or the waves of the sea.
The reason Moses was able to part the Red Sea was because he had authority from God to command the elements. It was nothing more than obedient intelligence. Moses commanded and the Red Sea obeyed. In the last days, right before the coming of Christ, there will be two prophets who also will have authority to command the elements:
Revelation 11:3-13
3 And I will give power unto my two witnesses, and they shall prophesy a thousand two hundred and threescore days, clothed in sackcloth.
4 These are the two olive trees, and the two candlesticks standing before the God of the earth.
5 And if any man will hurt them, fire proceedeth out of their mouth, and devoureth their enemies: and if any man will hurt them, he must in this manner be killed.
6 These have power to shut heaven, that it rain not in the days of their prophecy: and have power over waters to turn them to blood, and to smite the earth with all plagues, as often as they will.
7 And when they shall have finished their testimony, the beast that ascendeth out of the bottomless pit shall make war against them, and shall overcome them, and kill them.
8 And their dead bodies shall lie in the street of the great city, which spiritually is called Sodom and Egypt, where also our Lord was crucified.
9 And they of the people and kindreds and tongues and nations shall see their dead bodies three days and an half, and shall not suffer their dead bodies to be put in graves.
10 And they that dwell upon the earth shall rejoice over them, and make merry, and shall send gifts one to another; because these two prophets tormented them that dwelt on the earth.
11 And after three days and an half the Spirit of life from God entered into them, and they stood upon their feet; and great fear fell upon them which saw them.
12 And they heard a great voice from heaven saying unto them, Come up hither. And they ascended up to heaven in a cloud; and their enemies beheld them.
13 And the same hour was there a great earthquake, and the tenth part of the city fell, and in the earthquake were slain of men seven thousand: and the remnant were affrighted, and gave glory to the God of heaven.
The earth itself abides by law and fulfills the measure of its creation:
Doctrine and Covenants 88:25
25 And again, verily I say unto you, the earth abideth the law of a celestial kingdom, for it filleth the measure of its creation, and transgresseth not the law—