The U.S.S. Enterprise is en route to Starbase 6 for shore leave when Uhura receives a jumbled message from which all she can make out is a sector coordinate and the name U.S.S. Intrepid, a starship manned entirely by Vulcans. Suddenly, Spock shudders with pain and reports that the Intrepid just "died."
Kirk gets orders to head to Sector 39J because all contact has been lost with solar system Gamma 7A and with the Intrepid, which was investigating it. As the Enterprise changes course, long-range sensors show that the solar system, and its billions of people, are dead.
Approaching its destination, the U.S.S. Enterprise encounters a strange dark area in space. Kirk launches a probe. Seconds later, the crew hears a high-pitched whine throughout the ship, rendering half the people on board ill, and causing some to faint. Spock speculates that the phenomenon is some form of energy that is probably responsible for the death of the system inhabitants and the Intrepid crew. Kirk decides to move closer, and the crew hears the whine again. This time when they recover, the stars seem to have vanished. Spock reports that the noise was produced when the Enterprise passed through a boundary layer, and that they are surrounded by a field that is draining their mechanical and biological energy. McCoy confirms this when he reports from sickbay that everyone on the ship is dying.
Attempts by Scotty to recalibrate the engines and break free from the dark zone fail, and in fact the ship's expenditure of energy attracts an enormous amoeba-like creature approximately 18,000 kilometers in length. McCoy identifies the creature as an incredibly simple, single-celled organism which feeds on energy, but he needs more data to save the ship. He and Spock each volunteer to take a shuttle to investigate the creature — what would most certainly be a suicide mission — and Kirk decides to send Spock.
Spock takes the shuttlecraft through the creature's membrane and moves toward its nucleus. He reports that the creature appears to be ready to reproduce. He loses voice contact but manages to continue transmitting data.
Kirk and McCoy determine that if the creature begins to reproduce, it will spread rapidly and pose a serious threat to the galaxy, so it must be destroyed. But the Enterprise only has enough power left to survive for an hour.
Kirk and McCoy realize they have to use the U.S.S. Enterprise as an "antibody." Kirk orders the ship to punch its way into the giant creature and set a course for the nucleus. An antimatter charge is attached to a probe with a seven-minute delay. As soon as it is lodged in the nucleus, the Enterprise backs away at full impulse. There are only a few seconds to spare, but then they detect Spock's shuttle. Kirk locks two tractor beams onto the shuttle, even though doing so delays their escape. But when the antimatter explosion ruptures the creature's membrane, both ships are thrown to safety.