The final instalment of the epic Lord of the Rings trilogy begins with a flashback, that depicts a scene in which, the hobbits Déagol and Sméagol are fishing near the Gladden Fields when Déagol accidentally goes overboard and discovers the One Ring in the river bed. Sméagol, immediately corrupted by the Ring, murders Déagol for it and is later exiled into the wilderness where he eventually becomes the creature 'Gollum'.
In the present, Gollum is leading Frodo and Sam to an entrance near Minas Morgul. King Théoden, Aragorn, Gandalf and the other heroes of Helm's Deep reunite with Merry and Pippin as Treebeard and the Ents have secured Isengard with Saruman a prisoner within his tower. In the extended edition, Saruman attempts to negotiate with Théoden and Gandalf for his freedom, but rejects Gandalf's conditional offer and shoots a fireball at him. Gandalf repels the attack and breaks Saruman's staff, taking away his powers.
Meanwhile Gríma, fed up with Saruman's abuse, fatally stabs him from behind before he is killed by Legolas. A dying Saruman falls from the tower where he is then impaled on a spiked waterwheel. His palantír is recovered by Pippin before Gandalf confiscates it.
Later that night, however, Pippin's curiosity for the palantír results with Sauron attacking the Hobbit's mind. But knowing Pippin would have a glimpse of Sauron’s plans, Gandalf deduces that he is planning to attack Minas Tirith, and rides there with Pippin. They find Denethor, the Steward of Gondor, full of grief for his lost son Boromir and paranoid over Aragorn’s claim to the throne.
To compensate for Boromir's death defending him, Pippin swears service to Denethor. The armies of Mordor, led by the Witch-king and the Nazgûl, drive Faramir and his men from their final stronghold of Osgiliath. At Gandalf's instruction, Pippin secretly lights the distress beacon to signal Théoden to assemble the Rohirrim for battle.
On the way, Aragorn is informed by Elrond that Arwen did not go to the Undying Lands, and is now dying. He gives Aragorn the sword Andúril to acquire the service of the Army of the Dead, who owe allegiance to the heir of Isildur. Aragorn, with Legolas and Gimli, ventures into the Paths of the Dead and demands the loyalty of the King of the Dead. Théoden rides to war, unaware that Éowyn and Merry have secretly joined his forces.
After being sent by Denethor on a fruitless mission to reclaim Osgiliath, Faramir is mortally wounded as his horse drags his unconscious body back to Minas Tirith with Sauron's armies at its heels. Believing he has lost both sons, Denethor descends into madness with Gandalf forced to organize the city defenses.
As the siege rages on, Denethor loses all hope for Minas Tirith and intends to burn himself and Faramir, expelling Pippin from his service when he tries to stop him. Pippin and Gandalf manage to save Faramir, but watch as a burning Denethor falls off a ledge to his death. Théoden's army arrives and decimates the Orcs before being overwhelmed by Haradrim riding on Oliphaunts while the Witch-king singles out and kills Théoden.
Éowyn desperately stands before the Witch-King, but is overpowered by the Nazgûl as he proclaims that no man can kill him. However, Merry stabs him from behind and Éowyn slays him, causing him to be undone not by a man, but a woman and Hobbit. Finally, Aragorn arrives with the Army of the Dead and routs Sauron's forces, ending the battle. Aragorn frees the Army of the Dead and their souls go to the afterlife.
As the events occur, on the way to Minas Morgul, Sam overhears Gollum's plans to murder them and take the Ring yet Frodo refuses to believe him. Hoping to remove Sam as an obstacle as they climb up the cliff to the secret way to Mordor, Gollum manipulates Frodo into driving Sam off before leaving him at the mercy of the giant spider Shelob.
Although Frodo manages to dispose of Gollum, he is paralyzed as Sam arrives to drive Shelob off. Believing Frodo to be dead as he takes Sting and the Ring, he learns of his friend's condition when he follows an Orc patrol that takes Frodo's body to Sauron's fortress. Taking advantage of the Orcs warring amongst themselves, Sam sneaks in and rescues Frodo while returning the Ring to him. The two continue the journey to Mount Doom.
Meanwhile, Aragorn leads his remaining men to the Black Gate of Mordor to distract Sauron’s forces for Frodo to reach Mount Doom. As Sam carries the weakened Frodo up the volcano, Gollum reappears and attacks them. Though Frodo succumbs to the Ring's power as he reaches the Crack of Doom, Gollum bites off the Hobbit's finger to reclaim the Ring.
In the resulting struggle, Gollum falls into the lava while Sam saves Frodo as the Ring is destroyed. With the Ring gone, Sauron is obliterated and most of Mordor collapses while the surviving Orcs flee. Frodo and Sam are saved from the erupting volcano by Gandalf and the Eagles.
Soon after, Aragorn is crowned king and marries Arwen, while the four Hobbits are honoured for their deeds. Four years after they return home to the Shire, Frodo departs Middle-Earth for the Undying Lands alongside Bilbo, Gandalf and the Elves, bringing an end to the Fellowship, while giving Sam his book detailing their adventures together.