The Two Towers Book 4, Chapter 9
In the tunnels there is no difference between night and day and a wretched smell gets stronger as they ascend. They come to a tunnel that they must enter to secretly make a passage into Mordor. The hideous stench increases within, but it is the only way according to Gollum. They pass inside a great darkness and must feel their way through. After a while they come to an opening and see many passages. The heat increases and the smell becomes almost unbearable. After what seems hours, they come to a void on one side. They narrowly miss falling into it. When they come to a fork in the tunnel, Sam and Frodo realize that Gollum has disappeared. They hear a hiss and Sam sees a light in his mind. He knows that they are in trouble and tells Frodo to use the phial from Galadriel. Frodo takes it out and it illuminates the tunnel. They turn and there is a beast with hundreds of eyes. It gets closer and Frodo yells for Sam to run. He lifts the phial and draws his sword. He advances against the creature and it begins to retreat. It disappears and the hobbits begin to run through the tunnels. They enter a room filled with spider webs that Sam's sword will not cut. Frodo's swords will cut and he begins to carve a path through the webs. Sam is relieved because he thinks that they will be safe:
"It seemed light in that dark land to his eyes that had passed through the den of night. The great smokes had risen and grown thinner, and the last hours of a sombre day were passing; the ed glare of Mordor had died away in sullen gloom. Yet it seemed to Frodo that he looked upon a morning of sudden hope." Book 4, Chapter 9, pg. 422
The creature, called Shelob entered Mordor before Sauron in the form of a spider. Smeagol had worshipped her and promised to bring her food if he could keep whatever he found on the bodies. Gollum had led the hobbits to her. She wanted sweeter meat than orcs. Sauron knows she exists and finds her amusing. He often stuffs prisoners in her dark holes to perish. Sam knows nothing of the creature lurking behind them and thinks that Frodo's sword is turning blue because there are orcs around. The hobbits are almost out when the spider jumps between them and pounces on Frodo. Sam calls out, but Gollum jumps on him and brings him to the ground. Sam struggles and bursts into a rage. He attacks Gollum and hurtles him backwards. He strikes Gollum over the back with his staff and it breaks. He spins around to see Shelob on top of Frodo.