The giant spider that attacks Frodo in J.R.R. Tolkien’s The Two Towers is Shelob.
Shelob lives in a pass near Cirith Ungol and attacks Frodo after Gollum leads him and Sam into her lair. Gollum hopes that Shelob will kill the travelers, allowing him to recover the One Ring. Frodo is poisoned and appears dead, but Sam drives Shelob away with Sting and the light of the Phial of Galadriel.
Shelob is described as a descendant of Ungoliant, the enormous spider-like being from Tolkien’s earlier mythology. Ungoliant is not the creature Frodo meets in the Cirith Ungol episode, which is why the two names should not be treated as interchangeable.
The encounter occurs in the book’s fourth chapter, “The Choices of Master Samwise,” near the end of The Two Towers.