The First Order track the Resistance as they escape from their base. Leia is sucked out into space when the bridge of her ship is destroyed, killing Admiral Ackbar, but manages to pull herself to safety using the force. The ships are being tracked so can't get away, but can stay on the edge of weapon range, albeit dangerously low on fuel. Finn, Poe and BB-8, unhappy with the idea of running with no clear escape in sight, form a plan to disable the tracker. Finn teams up with Rose, a mechanic, to sneak away and find someone who can help them get onto Supreme Leader Snoke's ship, the Supremacy.
Meanwhile Rey is trying to persuade Luke Skywalker to train her, but he's resistant, feeling burdened with his failures as a Jedi Master. He reluctantly agrees to teach her after learning that she's in contact with Ren via some sort of mental link. Rey learns that Luke inadvertently secured Ben's turn to the dark side - sensing his darkness, in a moment of weakness he ignited his lightsaber while Ben slept, intending to kill him. He instantly regretted his action, but Ben awoke, saw what happened, collapsed the building they were in and escaped, causing carnage. He burned the Jedi Temple, and killed most of the Jedi students.
Luke is frightened of Rey's power, and refuses to join her when she opts to leave and go to Kylo Ren, believing she can turn him back to the light. Luke goes to burn down the temple on Ahch-To, but can't bring himself to. The spirit of Yoda appears and ignites the fire himself, telling Luke that he focuses too much on the past and future, not on the present. He dismisses the ancient Jedi texts as "page turners, they are not". Yoda tells Luke that failure is the greatest teacher, and it's the curse of a Master to be that which their students grow beyond.
Finn and Rose are captured in the casino they were directed to on Canto Bight - they don't recruit the master cracker they were searching for, but instead are imprisoned with DJ, who demonstrates his lockpicking skills, and they figure he's the best they'll get. They escape the planet with the help of some children who are enslaved in the stables. Arriving back at the fleet, they manage to sneak aboard the Supremacy and enter the room holding the tracker, but are discovered and captured.
Voluntarily arriving on the Supremacy, Rey is handcuffed and taken to Snoke. He tells them he forged the mental link between them to make this meeting happen, and commands Kylo Ren to kill Rey, claiming as he knows Ren's mind, he knows exactly what will happen. Ren deceives him by secretly turning Rey's lightsaber towards Snoke using the force, as he turns his own as if to kill her, masking his thoughts. He then ignites it through Snoke's side, and pulls it towards himself, slicing Snoke in half. He asks Rey to join him, and allow the surviving Rebels to be destroyed, in order to move on from the past and make way for the new. She instead force-pulls her lightsaber towards her, Kylo intercepts, and they fight for it, with it suspended between them. It eventually breaks under the pressure, and the blast wave helps her to escape, taking the broken halves.
The Rebels flee their ship in small, unarmed transports, intending to sneak down to the planet Crait. Holdo stays aboard to pilot the ship and provide cover for the escape. However DJ makes a deal with the First Order, giving away the Rebels' plan in order for his own freedom, leaving Finn and Rose as prisoners on the Supremacy. The Rebel ships start getting picked off one by one - Holdo turns the cruiser towards the Supremacy and initiates a light speed jump, sacrificing herself but splitting the Supremacy in two, allowing the surviving Rebels to make it to the surface, and Finn and Rose to escape in an First Order shuttle, joining them.
With limited weapons, the Rebels defend as best they can, but their few ships are mostly destroyed. Finn ignores Poe's order to retreat and makes a suicide run on the battering ram cannon, but is saved by Rose, who knocks him off course, saving him, but seriously injuring herself. The cannon blows a hole in the armoured entrance to the Rebel hanger.
Luke arrives and goes out alone to face Kylo Ren and the First Order troops. Ren orders all weapons to fire on him - when the dust eventually settles, Luke stands unscathed, and Ren faces him one on one. The Rebels realise Luke is buying them time, and escape via a back entrance. Luke ducks Ren's attacks, before he lowers his guard and says he will not be the last Jedi, as we see Rey rescue the Rebels by moving rocks with the force, and they escape in the Falcon. Ren charges Luke, swiping his lightsaber directly through Luke's chest...with no result. Ren slowly realises that Luke has projected himself across the galaxy from his home on Ahch-To, and rages at the deception. Luke collapses, exhausted from the effort. Gazing at the rising sun his body disappears, and he becomes one with the force.
Leia tells the Rebels that the Rebellion will rise again, and we see children on Canto Bight telling the tales of Luke Skywalker to each other. One of them uses the force to pull a broom towards him, holds it like a lightsaber as he looks up at the stars, and we see a Resistance ring on his finger.