Shelob was a great spider-like creature akin to those of Nan Dungortheb in Beleriand, the last offspring of Ungoliant.

Ungoliant is in a main role in The Silmarillion. She was said to be a mighty spirit of darkness, who had assumed an arachnoid fana (corporeal form). She was the destroyer of the Two Trees of Valinor.

The origins of Ungoliant are shrouded in mystery. It was believed by some of the Eldar that she may have been among the Ainur whom Melkor had corrupted long ago in the beginning. It was later perceived by the Valar that she had come from "beyond Arda" in the "darkness that" lay around it when Melkor first gazed upon the Kingdom of Manwë in envy.

Ungoliant and Melkor together destroyed the Two Trees of Valinor, binding the world into perpetual darkness. Melkor had plundered the Elves' jewels, and Ungoliant wanted to satiate her hunger with the precious stones. As Melkor kept the Silmarils to himself, Ungoliant then attacked Melkor, and it was only with help of balrogs how he got free from the webs of Ungoliant.

Ungoliant then fled to South. She is perceived to be dead, and there are three theories of her death; either Eärendil slew him on his flying ship Vingilot, or she succumbed to her insatiable hunger, or her children, including Shelob, attacked and ate her when they hatched.

More Info: tolkiengateway.net