StarCraft takes place in a science fiction universe created by Chris Metzen and James Phinney for Blizzard Entertainment. According to the story presented in the game's manual, the overpopulation of Earth in the early 21st century has caused the international government to exile undesirable elements of the human race, such as criminals, the cybernetically enhanced and genetic mutants to colonize the far reaches of the galaxy. An attempt to colonize a nearby solar system goes wrong, resulting in humanity's arrival in the Koprulu Sector. In the distant Koprulu Sector of the galaxy, the exiles form several governments, but quickly fall into conflict with each other. One government, the Confederacy of Man, eventually emerges as the strongest faction, but its oppressive nature and brutal methods of suppressing dissidents stir up major rebel opposition in the form of a terrorist group called the Sons of Korhal. Just prior to the beginning of the game, in December 2499, an alien race possessing advanced technology and psionic power, the Protoss, makes first contact with humanity by destroying a Confederate colony world without any prior warning. Soon after this, the Terrans discover that a second alien race, the insectoid Zerg, has been stealthily infesting the surface of several of the Terran colonies, and that the Protoss are destroying the planets to prevent the Zerg from spreading. With the Confederacy threatened by two alien races and internal rebellion, it begins to crumble.
The player assumes the role of three nameless characters over the course of the game. In the first act, the player acts as the Confederate magistrate of an outlying colony world of Mar Sara, threatened by both the Zerg and the Protoss, and is forced through events to join the rebel Sons of Korhal under its leader Arcturus Mengsk. Mengsk's campaign is accompanied by Jim Raynor, a morally conscious law enforcement officer from Mar Sara, and Sarah Kerrigan, a psychic assassin and Mengsk's second-in-command. The second episode of the game sees the player as a cerebrate, a commander within the Zerg Swarm. The player is ruled over by the Zerg Overmind, the manifestation of the collective consciousness of the Swarm and the game's primary antagonist, and is given advice from other cerebrates of higher rank and status while accomplishing the objectives of the Swarm. In the final part of StarCraft, the player is a newly appointed officer (called Executor) within the Protoss military, reporting to Aldaris, a representative of the Protoss government. Aldaris is at odds with the former occupant of the player's position, Tassadar, over his association with Zeratul, a member of the dark templar, a group considered heretical by the Protoss government.
The story of StarCraft is presented through its instruction manual, the briefings to each mission and conversations within the missions themselves, along with the use of cinematic cutscenes at key points. The game itself is split into three episodes, one for the player to command each race. In the first segment of the game, the player and Jim Raynor are attempting to control the colony of Mar Sara in the wake of the Zerg attacks on other Terran worlds. After the Confederacy arrests Raynor for destroying Confederate property, despite the fact that it had been infested by the Zerg, the player joins Arcturus Mengsk and the Sons of Korhal. Raynor, who is freed by Mengsk's troops, also joins and frequently accompanies the player on missions. Mengsk then begins to use Confederate technology captured on Mar Sara to lure the Zerg to Confederate installations and further his own goals. After forcing Confederate general Edmund Duke to join him, Mengsk sacrifices his own second-in-command, Sarah Kerrigan, to ensure the destruction of the Confederacy by luring the Zerg to the Confederate capital Tarsonis. Raynor is outraged by Mengsk's true aims of obtaining power at any cost and deserts, taking with him a small army of the former colonial militia of Mar Sara. Mengsk reorganizes what remains of the Terran population into the Terran Dominion, crowning himself as emperor.
The second campaign reveals that Kerrigan was not killed by the Zerg, but rather is captured and infested in an effort to incorporate her psionic traits into the Zerg gene pool. She emerges with far more psionic powers and physical strength, her DNA completely altered. Meanwhile, the Protoss commander Tassadar discovers that the Zerg's cerebrates cannot be killed by conventional means, but that they can be harmed by the powers wielded by the heretical dark templar. Tassadar allies himself with the dark templar prelate Zeratul, who assassinates Zasz, one of the Zerg's cerebrates in their hive clusters on Char. The cerebrate's death results in its forces running amok through the Zerg hives, but briefly links the minds of Zeratul and the Zerg Overmind, allowing the Overmind to finally learn the location of the Protoss homeworld Aiur, which the Overmind has been seeking for millennia. The main Zerg swarm promptly invades Aiur while Kerrigan is dispatched to deal with Tassadar and despite heavy Protoss resistance, the Overmind is able to embed itself into the crust of the planet.
The final episode of the game sees Aldaris and the Protoss government branding Tassadar a traitor and a heretic for conspiring with the dark templar. The player initially serves Aldaris in defending Aiur from the Zerg invasion, but while on a mission to arrest Tassadar, the player joins him instead. A Protoss civil war erupts, pitting Tassadar, Zeratul, and their allies against the Protoss establishment. The dark templar prove their worth when they use their energies to slay two more of the Zerg cerebrates on Aiur, and the Conclave reconciles with them. Aided by Raynor's forces—who sided with Tassadar back on Char—the Protoss break through the Overmind's weakened defenses and destroy the Overmind's outer shell, but take heavy casualties in the process. Tassadar channels his own psionic energies in combination with those of the dark templar through the hull of his command ship and crashes it into the Overmind, sacrificing himself in order to destroy it.