The story begins aboard what appears to be the bridge of the starshipEnterprise. The whole original crew, save for James T. Kirk and Pavel Chekov, is aboard under the command of what appears to be a Vulcan woman named Saavik. They are on a mission to rescue a trading freighter known as the Kobayashi Maru. The ship is found to be adrift in the Klingon Neutral Zone. Saavik orders the ship to save the freighter, which is about to fall apart. Then a fleet of Klingon warships attack and seemingly kill the entire crew. Two large doors open, and Admiral James T. Kirk enters. It is found that this is a training simulator for a cadettest. Saavik finds it hard to understand the reasoning behind the scenario, which is that sometimes Starfleet commanders must face a no-win-scenario. Kirk is celebrating his birthday.

The Federation starship Reliant is on a mission to find a suitable world for the Genesis Device, a new terraforming tool that is in development. Chekov, who is an officer aboard the vessel, along with his crew, comes upon the planetCeti Alpha VI. They find only what appear to be traces of life, which cannot be present. On Earth, Kirk shows that he is in a mid-life crisis of sorts, wondering what his place now is in Starfleet, believing that his days aboard starships are done. Captain Clark Terrell and Chekov beam down from the Reliant to the barren planet. They discover a wrecked ship, which has been converted into what appears to be a safe haven from the planet. Chekov finds a tag that reads "Botany Bay". He then remembers this as the flagship of the mad Khan Noonien Singh, a power-crazed dictator from Earth's past. As Chekov attempts to hurry Terrell out, they are captured. Khan and his followers reveal to Terrell and Chekov that this is Ceti Alpha V, and that Ceti Alpha VI exploded, causing many deaths and the shift of the planet's rotation. Khan now has a vendetta against Kirk. Khan wants to know why Terrell and Chekov were looking for a lifeless planet. He uses a creature called a ceti eel to force them into revealing the knowledge.

Khan.

Kirk is due to inspect the starship Enterprise, which is on a cadet training voyage under the command of CaptainSpock. The ship sets out into space under the command of Spock. The whole crew, save for Chekov, is aboard. Meanwhile, at a Federation outpost called Regula One, a group of scientists led by Dr. Carol Marcus discover that the Federation are accelerating their plans for the Genesis Device, and that the Reliant is on its way to pick it up. The scientists are alarmed by this, and refuse to go along with it. Kirk and his crew receive a message from Dr. Marcus, who is worried about the Genesis Device. When Kirk, Spock, and McCoy learn what Genesis is, Kirk assumes command and sets a course for the outpost.

The Enterprise encounters the Reliant, which is under Khan's command. Kirk and Khan do battle, and seriously damage each other. Scotty's nephew Peter Preston is killed. Kirk and his crew arrive at Regula One, which is deserted. Kirk, McCoy, and Saavik beam over to the station and find most of the scientists have been murdered. They then check the transporter logs and find that the beam coordinates were to the center of the dead planetoid that Regulus I was orbiting. They find the Genesis Cave, the Genesis Device, and Doctors Carol and David Marcus. It is revealed that Kirk and Carol were once involved and that David is their son. Khan is able to retrieve the device, and believes he has stranded Kirk and company in the planetoid.

Spock's funeral.

Spock, using a coded transmission, is able to evade Khan and get the crew aboard. After Kirk enters the Mutara Nebula and heavily damages Khan's ship, Khan is prepared to detonate the Genesis Device to destroy them both. The Enterprise does not have enough power to escape, but Captain Spock sacrifices his life to save them all. The Genesis Wave from Khan's destroyed ship ends up terraforming a planet. As Scotty plays "Amazing Grace" on the bagpipes, Spock's body is launched into space above the planet on a course selected by Saavik. Kirk and crew set course for Earth, awaiting adventures unknown.

Some major differences between the novelization and the movie are due to last-minute changes to the screenplay. In the novel, Kirk does not know that David Marcus is his son until he meets him inside the Genesis planetoid. This point was left ambiguous in the movie until a late re-shoot clarified that Kirk had always known he was David's father. There is no indication in the novel of Spock transferring his katra to McCoy, or of Spock's casket landing safely on the Genesis Planet, because those elements were not added to the movie until a late stage. Indeed, Spock's line "Remember" was not added to the script until the day it was filmed.

"The Wormhole Connection" - (TOScomic) - Set after The Wrath of Khan this comic sees Kirk personally request Grand AdmiralStephen Turner allow him to remain in command of the Enterprise, which Turner approves. The story then deals with Kirk's reaction to Saavik (who takes Spock's former role as science officer) while he grieves for Spock.

The Search for Spock (TOS movie) - Spock transfers his katra to Doctor McCoy before his death in The Wrath of Khan, allowing his resurrected in The Search for Spock when his katra is transplanted back into his body which regenerated on the Genesis Planet.

The Chimes at Midnight (TOS/Myriad Universes novel) - Set in an alternate timeline where Thelin is aboard the Enterprise instead of Spock and the Genesis Planet is still created, although in this case Thelin uses a shield modification to allow the Enterprise to survive the Genesis effect rather than sacrificing himself to repair the ship's engines.

"Cloak and Dagger" (EV comic) - The conflict between the Enterprise and the Reliant is mirrored in this comic. The Enterprise faces another Miranda-class starship, the USS Cortez, and once again the ship has been commandeered by fanatics. Like the film Number One uses the Cortez's command codes to take down the shields to make it vulnerable after its initial brutal attack. And finally like the Reliant the Cortez is destroyed by a powerful technology, though in this case a planet is destroyed in the process rather than created.