The first book by J.R.R. Tolkien to feature Middle-earth in print was The Hobbit.
The Hobbit was published in 1937 and introduced readers to places and peoples that later became central to Tolkien’s Middle-earth, including the Shire, Rivendell, the Misty Mountains, and the Elves. The name “Middle-earth” itself was part of Tolkien’s developing mythology, though the geography and terminology evolved across his manuscripts and published works.
The Lord of the Rings followed in three volumes between 1954 and 1955. It expanded the earlier children’s adventure into a darker historical epic and connected Bilbo’s ring to the One Ring created by Sauron. The Silmarillion, although containing much older fictional history, was not published until 1977, after Tolkien’s death.
This distinction concerns publication order, not the internal chronology of the stories. Much of the mythology behind The Silmarillion predates the events of The Hobbit within Tolkien’s imagined history.