Lights, camera, action!
Even in the 23rd century, midlife crises happen.
So it is for James T. Kirk (William Shatner): space cowboy, smirky savior of the universe and current Starfleet admiral. We first find him in the midst of training a new crew for the starship Enterprise: a crew intended to replace him and his buddies. (Ouch.)
A morose birthday celebration is followed by a low-key training exercise meant to put those fresh young cadets through the paces of a starship cruise with the safety rails firmly in place.
Elsewhere, one of Kirk's former junior officers, Pavel Chekov (Walter Koenig) and Chekov's current commanding officer Captain Terrell (Paul Winfield) are surveying planets for a super-secret science project: the Genesis Device, an engineered missile that can be fired at a dead planet and instantly turn it into a paradise. Terrell's ship, the Reliant, is off looking for the right dead planet to test the thing.
But, like all such Frankenstein-like creations, the Genesis Device has a wrinkle: shooting it at a dead planet gets you a paradise. Shooting it at a living one gets you a paradise… after it destroys every living thing on that planet first.
They find more than they bargained for. After detecting life forms on a planet that's supposed to be rock-infested emptiness, they beam down to find a squad of marooned bad guys. They were left there by Kirk back in his young, stud-muffin days and promptly forgotten about while the formerly livable environment took a turn for the sand-stormy.
Led by the implacable unfrozen 20th-century madman Khan (Ricardo Montalban), they stick a pair of mind-control ear worms in Chekov and Terrell (and yes, it's just that squicky) before seizing control of the Reliant and heading off to carve them up some Kirk steaks.
Kirk and his crew learn about this when they get a garbled message from Carol Marcus (Bibi Besch), former flame and the scientist in charge of Genesis, who demands to know why Kirk is "taking Genesis away" from her. Turns out, that's just Khan…trying to draw Kirk out and get hold of the Genesis Device himself.
It works. Kirk and the Enterprise think that Carol is in some kind of trouble, and Starfleet agrees. The ship goes on its merry way, only to cross paths with the Reliant, which was lying in wait for them. (Space pirates; what are you gonna do?).
Khan phasers the righteous snot out of the Enterprise …and would have finished the job were it not for Kirk's fast thinking and the Reliant's eminently hackable shields system. Both ships retreat, damaged beyond the ability to continue the fight. The Enterprise limps its way to space station Regula One, headquarters of Project Genesis, with the Reliant threatening to return and finish the job at any moment.
Kirk and an away team beam over to the space station, where they find a lot of dead doctors and Chekov and Terrell…still secretly under the influence of the ear worms. He also finds the transporter room with coordinates seemingly in the middle of a nearby dead moon. After a terse conversation with Mr. Spock (Leonard Nimoy) about the progress of repairs to the Enterprise—bad news, apparently—they follow the transporter coordinates to see what's what.
There, they find an underground cavern occupied by Dr. Marcus, her son David (Merritt Butrick), and a doctor moonlighting as one of the series' infamous Red Shirts…along with the Genesis Device. Chekov and Terrell take the opportunity to spring a trap: killing the Red Shirt and revealing their status as Khan's personal zombots. Khan, who's been listening the whole time, orders them to kill Kirk.
That's apparently a bridge too far. Terrell, fighting the ear worm's influence, phasers himself into oblivion rather than shoot Kirk, while Chekov collapses and sends the ear worm slinking out of his brain for Kirk to conveniently phaser. Khan settles for the draw, beams the Genesis Device onboard the Reliant and heads off looking to finish the job on…the Enterprise, leaving Kirk and Co. stranded in the cavern for all time.
Kirk and Dr. Marcus have a heart to heart about their relationship, getting older, and the fact that David—who really doesn't like Kirk much—is actually Kirk's son (which Mom has kept secret from him). They take a look at the bountiful wonderland in the rest of the cave, courtesy of an earlier stage of the Genesis experiment, then Kirk checks back in with Spock.
Things are better than they had first suggested, and the ship has enough power to beam them back up. Kirk and Spock had super-cleverly spoken in code (suspecting, rightly, that Khan would be listening in) and fooled their nemesis into believing the Enterprise was more damaged than it was.
Sadly, it's still pretty damaged. Warp power is inoperative—otherwise, they'd kick on the afterburners and come back with a whole fleet to whomp Khan's buckwhacking hiney—and they don't have as much firepower as the Reliant either. But there's the Mutara Nebula nearby, which would render phaser lock and shields inoperative and basically give the two ships a level playing field. Kirk and the gang head toward it with all deliberate speed and then goad Khan into following them.
It's game on inside the nebula as the two ships circle each other looking for an edge. Spock finally suggests one by noting that Khan thinks two-dimensionally, like a ship at sea, rather than three-dimensionally, like a spaceship in a nebula.
The Enterprise hits the "reduce altitude" button and waits for the Reliant to pass over it, then pops up behind it and phasers it into the Stone Age. High fives and Romulan ales all around.
Kirk and the gang prepare to beam aboard and take Khan into custody…
…except that Khan has an ace up his sleeve: the Genesis Device, which he starts building up to a detonation which will destroy the Reliant and the Enterprise along with it. They need warp speed in three minutes in order to escape the explosion…which is something they just can't do with their busted engines.
As the ship tries desperately to limp away, Spock takes matters into his own hands. He heads down to the engine room, then uses his Vulcan nerve pinch to disable Dr. McCoy (DeForest Kelley), who's standing between him and the irradiated doohickey preventing the ship from going.
He enters the irradiated engine core to fix the damage and restore light speed just in the nick of time…taking Cherobyl levels of radiation in the process.
The Enterprise speeds away as the Genesis Device goes off, destroying Khan and the Reliant and imbuing the nearby planetoid Nebula One with its mojo. The planet reshapes itself into a bountiful swath of green and Kirk starts up with the high-fives again…until he gets a comm call from McCoy, telling him to get his butt down to the engine room before Spock's organs turn to goo.
Kirk and Spock have a final, tearful good-bye through the clear walls of the engine core, with Spock accepting his fate and admonishing Kirk not to grieve, since "the needs of the many outweigh the needs of the few, or the one." What a hero.
A funeral service is held, and Spock's body is placed in a photon torpedo and launched at the newly formed Genesis Planet.
Kirk, attempting to read a copy of A Tale of Two Cities (which Spock gave him on his birthday) is interrupted by David. The young Dr. Marcus encourages him to listen to the wisdom of Spock's last words, and also that he is "proud…very proud, to be your son." He and Kirk embrace, and Kirk returns to the bridge to watch the sunrise on the new world, rejuvenated and at peace.