Objects in Hebrew are usually marked out by the word את. video So in Gen. 1:1, we know that הַשָּׁמַיִם is the object of בָּרָא because of the object marker.
בְּרֵאשִׁית בָּרָא אֱלֹהִים אֵת הַשָּׁמַיִם וְאֵת הָאָרֶץ׃
Many times, the object marker word will be connected to its noun with a maqqef as in Gen. 1:4.
וַיַּרְא אֱלֹהִים אֶת־הָאֹור כִּי־טֹוב וַיַּבְדֵּל אֱלֹהִים בֵּין הָאֹור וּבֵין הַחֹשֶׁךְ׃
This object marker word not only marks out the object but also marks the following noun as definite. This word can also take pronominal suffixes (KHW 23.2b).
Note: there is a preposition which is spelled exactly the same; see here or Gesenius.