Star Trek: The Doomsday Machine

On stardate 4202.9, the USS Enterprise responds to a distress call and finds that several planets in a nearby system have been destroyed. They soon find their sister ship, the USS Constellation adrift and heavily damaged. Captain Kirk and a damage control team beam over to investigate and find the ship's commanding officer, Commodore Matthew Decker, holed up in the auxiliary control room – apparently the sole survivor. Mr. Scott reports that the ship's warp engines are damaged beyond repair and the weapons exhausted. Meanwhile, an incoherent Decker can only mutter about something attacking his ship.

The logs reveal that the ship investigated the break up of a planet and was soon attacked by an enormous machine with a conical shell miles in length and a giant opening at one end filled with sparkling energy. After the attack, Decker ordered his surviving crew to the surface of a nearby planet, but to his horror, the machine destroyed that world next. Spock theorizes the machine breaks down planets into rubble which it then consumes for fuel and adds that given its past trajectory, it is likely to have come from outside the galaxy.

Kirk has Decker beamed to the Enterprise while he and Scott remain on the derelict. On the Enterprise bridge, Mr. Spock is alerted to the approach of the alien machine which generates interference that makes radio contact with Starfleet Command impossible. As the machine attacks, Decker comes to the bridge, and quoting Starfleet regulations he pulls rank on Spock and assumes command. He then orders a full on attack against the machine ignoring Spock's warning that the ship's weaponry is ineffective against the doomsday machine's pure neutronium hull. As a result, the warp engines are disabled and the Enterprise becomes drawn by a tractor beam towards the machine's glowing maw.

Aboard the Constellation, Scott has managed to restore partial phaser and thrust control, and Kirk creates a diversion to distract the planet-killer away from the Enterprise. As the machine veers off, Kirk orders Spock to relieve Decker of command as he is in no condition to give orders. After protest, Decker finally yields, but he knocks out his guard and quickly heads to the hanger bay and steals a shuttlecraft. He then pilots it on a kamikaze course into the planet killer's maw despite the pleas of Kirk and Spock to turn back.

After learning the shuttle explosion registered a weakening in the planet-killer's power output, Kirk realizes Decker may have had the right idea. Kirk has Spock verify if detonation of the Constellation impulse engines, "inside" the planet-killer, would be sufficient in destroying the machine. Although strongly advising against the idea, Spock confirms and Kirk has Scotty rig the engines with a 30-second delay detonator. Kirk however, plans only to remain aboard the Constellation long enough to ensure the ship will enter the maw and he plans to beam back to the Enterprise before detonation.

Once everything is prepared, Kirk orders Scott and the rest party back to the Enterprise and steers a course into the planet killer's maw. Once close enough, he activates the explosives and calls for his beam out – however, having suffered damage in the first attack, the Enterprise transporter short outs and Scott rushes to make repairs. As seconds count down, Kirk nervously watches the inexorable menacing maw of the doomsday machine drawing closer. Scott's desperate repairs succeed and at the last second, Kirk is beamed off the Constellation as the ship enters the maw. The resulting explosion burns out the planet-killer, leaving its indestructible body shell drifting quite dead in space.