In Klingon space, three Klingon battle cruisers encounter a huge cloud-like anomaly. On the bridge of one of the ships, the captain (Mark Lenard) orders his crew to fire torpedoes at it, but they have no effect. The ships take evasive action.
Meanwhile, in Federation space, a monitoring station, Epsilon 9, picks up a distress signal from one of the Klingon ships. As the three ships are attempting to escape the cloud, energy beams shoot out and engulf each ship one by one, and they vanish. On Epsilon 9, the crew tracks the course of the cloud and discovers that it is headed for Earth.
On Vulcan, Spock (Leonard Nimoy) has been undergoing the kohlinahr ritual, in which he has been learning how to purge all of his emotions, and is nearly finished with his training. A female Vulcan Master (Edna Glover), surrounded by two men, is about to give him an ornate necklace as a symbol of pure logic, when Spock holds out his hand to stop her.
Confused, she mind-melds with him and senses a consciousness calling to him from space that is affecting his human side. She drops the necklace. "You have not yet achieved kohlinahr. You must look elsewhere for your answer," she says as they leave Spock. "You will not find it here."
In San Francisco, Admiral James T. Kirk (William Shatner) arrives at Starfleet Headquarters in a shuttlecraft. He sees Commander Sonak (Jon Rashad Kamal), a Vulcan science officer who is joining the Enterprise crew and recommended for the position by Kirk himself. Kirk is bothered as to why Sonak is not on board yet.
Sonak explains that Captain Willard Decker (Stephen Collins), the new captain of the Enterprise, wanted him to complete his science briefing at Headquarters before they left on their mission. The Enterprise has been undergoing a complete "refitting" for the past 18 months and is now under final preparations to leave, which would take at least 20 hours, but Kirk informs him that they only have 12. He tells Sonak to report to him on the Enterprise in one hour; he has a short meeting with Admiral Nogura and is intent on being on the ship.
Kirk transports to an office complex orbiting Earth and meets Montgomery Scott (James Doohan), the Enterprise's chief engineer. Scotty expresses his concern about the tight departure time. The cloud is less than three days away from Earth, and the Enterprise has been ordered to intercept it because they are the only ship in range.
Scotty says that the refit can't be finished in 12 hours, and tries to convince him that the ship needs more work done as well as a shakedown cruise. Kirk insists that they are leaving, ready or not. They board a travel pod and begin the journey over to the drydock in orbit that houses the Enterprise.
Scotty tells Kirk that the crew hasn't had enough transition time with all the new equipment and that the engines haven't even been tested at warp power, not to mention that they have an untried captain. Kirk tells Scotty that two and a half years as Chief of Starfleet Operations may have made him a little stale, but that he wouldn't exactly consider himself untried.
Kirk then tells a surprised Scotty that Starfleet gave him back his command of the Enterprise. Scotty doubts it, saying that he doesn't think it was that easy with Admiral Nogura, who gave Kirk his orders. They arrive at the Enterprise, and Scotty indulges Kirk with a brief tour of the new exterior of the ship.
Upon docking with the ship, Scotty is summoned to Engineering. Kirk goes up to the bridge, and is informed by Lt. Uhura (Nichelle Nichols) that Starfleet has just transferred command from Captain Decker over to him. Kirk finds Decker in engineering, whom is visibly upset when Kirk breaks the news that he is assuming command, but recognizes it is because Kirk has more experience.
Decker will remain on the ship as 2nd officer. As Decker storms off, an alarm sounds. Someone is trying to beam over to the ship, but the transporter is malfunctioning. Kirk and Scotty race to the transporter room. Transporter operator Janice Rand (Grace Lee Whitney) is frantically trying to tell Starfleet to abort the transport, but it is too late.
Commander Sonak and an unknown female officer are beaming in, but their bodies aren't re-forming properly in the beam. The female officer screams, and then their bodies disappear. Starfleet signals to them that they have died. Kirk tells Starfleet to express his sympathies to their families.
In the corridor, Kirk sees Decker and tells him they will have to replace Commander Sonak and wants another Vulcan. Decker tells him that no one is available that is familiar with the ship's new design. Kirk tells Decker he will have to double his duties as science officer as well.