“Then God spoke.” The Ten Commandments were audibly spoken by God from the top of Mount Sinai to the people. The fact that the text says that “God [Elohim] spoke,” and not “Yahweh spoke” points to the fact that these commands were to be applicable to all people, not just Israel. The people were frightened by the voice of God and asked that He not speak to them anymore (Exod. 20:19, 22; Deut. 5:4, 22-27).
It is commonly taught that the first time Israel got the Ten Commandments was when Moses came down Mount Sinai with them, but that is not accurate. Israel personally had the Ten Commandments spoken to them directly by God (Exod. 20:1-17). It was more than a month later that Moses went up on Mount Sinai and got the commandments on stone—and even then Moses broke those first tablets (Exod. 24:15-18; 31:18; 32:19). The second set of stone tablets was made by Moses but written on by God (Exod. 34:1-4; cp. Deut. 9:10-11,15-17; 10:1-5).
At this time, when Yahweh spoke the Ten Commandments to Israel, Moses was down at the foot of the Mountain with the people. He had come down (his third trip down) in Exodus 19:25, and he did not go back up for his fourth time up until Exodus 20:21, and he came back down with an important part of the Law in Exodus 24:3.
[For more on God speaking the Ten Commandments directly to the Israelites, see commentary on Exodus 19:9. For more on Moses’ seven trips up and down Mount Sinai, see commentary on Exodus 19:3.]