The connecting record
shownThe Two Towers · Book IV ch. 10 “The Choices of Master Samwise”
Samwise Gamgee beat Shelob in The Two Towers.
Cuts off a claw and puts out an eye; she drives herself onto the blade he holds up, and he drives her off with the star-glass.
What each of them is ranked on
The winner · Samwise Gamgee · rank 33
shownThe Two Towers · Book IV ch. 10 “The Choices of Master Samwise”
Charges Shelob with Frodo's sword in his left hand and his own in the other; Frodo's sword shears away a claw, and his other hand stabs out one of her eyes.
shownThe Two Towers · Book IV ch. 10 “The Choices of Master Samwise”
Holds the elven-blade point upward as she sinks on him, and she thrusts herself upon it and springs back in anguish.
shownThe Return of the King (film) · Shelob's lair
Faces Shelob with Sting in one hand and the phial of Galadriel in the other, and she retreats after he wounds her with Sting.
Beaten · Shelob · rank 27
Shelob the Great
Stung Frodo in the pass of Cirith Ungol and bound him in her cords. Her hide had held for ages against everything that came into her tunnels. She is the last child of Ungoliant still troubling the world, and the narrator says no strength of Men could pierce her, not even with Beren's or Túrin's hand on the blade. Then Sam charged her with Sting in one hand and his own sword from the Barrow-downs in the other. Sting cut off a claw, his other blade put out an eye, and she drove herself down onto Sting as he held it up. Only then did he raise the star-glass, and she crawled away from its light into the dark. The book does not say whether she died.
statedThe Two Towers · Book IV ch. 9 “Shelob's Lair”
Named the last child of Ungoliant to trouble the unhappy world, with none to rival her.
shownThe Two Towers · Book IV ch. 10 “The Choices of Master Samwise”
Comes behind Frodo with hideous speed and stings him in the neck; Sam afterwards cuts away the cords binding him.
statedThe Two Towers · Book IV ch. 10 “The Choices of Master Samwise”
Her age-old hide, thickened layer on layer, could not be pierced by any strength of men, not though the hand of Beren or Túrin wield the blade.
All 5 citations
shownThe Two Towers · Book IV ch. 10 “The Choices of Master Samwise”
Drives her bulk down onto the elven-blade Sam holds point upward, and it pierces her deep.
shownThe Return of the King (film) · Shelob's lair
Stings Frodo and wraps him in silk; Sam wounds her with Sting and she retreats to her hole.
What this does not settle
One fight in one work. It is the only result the record gives between these two, and it is evidence about that meeting and nothing wider — not a general matchup, not a rematch, and not a ranking of its own.
The ranking is argued from everything either of them has been shown doing; this page is argued from one citation.
Where the two disagree, the disagreement is the point, and it stays visible rather than being resolved by whichever of them happens to be on this page.