In 2014/2015, bio-medical engineer Dr. Ryan Stone is a Mission Specialist on her first space shuttle mission, STS-157. She is on a spacewalk repairing a panel on the Hubble Space Telescope, accompanied by veteran astronaut Matt Kowalski, who is commanding his final expedition. Mission Control suddenly instructs them to abort their spacewalk and return to the STS. Houston tells them that debris from a Russian missile strike on a defunct satellite has caused a chain reaction, destroying other satellites, and a huge debris field is heading right at them. Within a couple of minutes, they lose contact with Mission Control, though Stone and Kowalski continue to transmit "in the blind", hoping that the ground crew can hear them.
High-speed debris strike the STS, sending it spinning wildly, with Stone at the end of the boom arm. A piece of debris breaks the robot arm off from the STS, and Stone is forced to release the tether holding her to the robot arm. Once free, she is thrown far from the STS. Stone panics, trying to contact Houston or Kowalski. Kowalski, who is wearing a thruster pack, suddenly appears and attaches her tether to him. He flies them back to the STS; on the way they find the engineer Shariff, his helmet smashed and his skull mostly open and empty. They find that the STS Explorer has been catastrophically damaged. The shuttle's interior has been ripped open by debris and the remainder of crew are dead. Kowalski decides to use the thruster pack to get to the International Space Station (ISS), which is in orbit about 100 km (60 mi) away. Kowalski estimates they have 90 minutes before the debris field completes an orbit and threatens them again.
With Stone's oxygen reserve running low, they float through space to the ISS. Kowalski asks Stone about her life back home and learns that her daughter died in a schoolyard accident. As they approach the slightly damaged ISS, they see that its crew has already evacuated in one of the Soyuz modules and that the parachute of the other Soyuz, designated TMA-14M, has accidentally deployed, making it useless for return to Earth. Kowalski says that the Soyuz can still be used to travel to Tiangong, the nearby Chinese space station, to retrieve another module that can take them to Earth. All but out of air and maneuvering fuel for the thruster pack, the two try to grab onto the ISS as they zoom by. The tether holding them together breaks and at the last moment, Stone's leg becomes entangled in the Soyuz's parachute lines. Stone grabs Kowalski's tether, just barely stopping him from flying off into space. Kowalski realizes that his momentum will carry them both away, and over Stone's protests, he decouples his end of the tether so that Stone can survive. The tension in the lines pulls her back towards the ISS. As Kowalski floats away, he radios her with additional instructions about how to get to the Chinese space station, encouraging her to continue her survival mission.
Stone enters the ISS through an airlock and gets out of the spacesuit. She begins to get familiarized with the ISS when an alarm suddenly alerts her to a fire. She makes her way to the module where the fire is and attempts to put it out, but she is momentarily stunned when the force of the extinguisher thrusts her backward into the bulkhead. She recovers and knocks the flames down again and pushes through them towards the Soyuz. With the fire closing in, she closes the hatch, pulling in the fire extinguisher at the last moment when it blocks the hatch. She separates from the ISS only to find that the Soyuz's parachute lines are entangled in the station's rigging. She dons a Soviet spacesuit and exits the spacecraft to release the cables when the debris field completes its orbit. Clinging to the Soyuz, the ISS is destroyed around her. Free of the ISS and the parachute lines, Stone reenters the spacecraft and aligns it with Tiangong. She fires the thrusters but the fuel gauge is wrong: the tanks are empty. Stone realizes she is stranded and believes she'll die. After listening to an Inuit fisherman on the ground speak to her, she slows the oxygen flow which will cause her to fall into unconsciousness from lack of oxygen before she dies. As she begins to lose consciousness, Kowalski suddenly appears outside, opens the spacecraft lock, and enters the cabin. He cheerfully asks her if she wants to live or die. He tells her to use the Soyuz's landing rockets to reach Tiangong. As she returns to full consciousness, Kowalski is gone, part of a hallucinatory dream. Stone restores the flow of oxygen and uses the landing thrusters to navigate towards Tiangong.
With no fuel to slow or to dock the Soyuz with the Chinese station, Stone ejects herself from the Soyuz via explosive decompression. She uses the remaining pressure in the fire extinguisher as a makeshift thruster to push herself towards Tiangong, which has also been abandoned. She enters the Tiangong space station and makes her way through its interior to the Shenzhou capsule. The Tiangong station's orbit has deteriorated due to hits by the debris field and it begins to break up on the upper edge of the atmosphere. Stone is unable to separate the capsule from the space station, and she resigns herself to her fate, whatever it may be.
As the space stations begins to break up, the Shenzhou capsule is broken off from the station, and Stone fires the device that separates the capsule from the rest of the spacecraft. As the capsule falls towards earth, it rights itself and descends through the atmosphere. The radio crackles with traffic from Mission Control, who are tracking the capsule, and tell her that rescue is on its way. The chute automatically deploys and Stone lands in a lake near the shore. The cabin is full of smoke, and after she blows the hatch the capsule tilts, allowing water to enter. Just when she thought she was safe, she's unable to exit the capsule. The capsule sinks to the bottom with Stone inside. Stone finds a bubble of air inside the capsule and exits the capsule, shedding her spacesuit so she can get to the surface. She swims to shore and with difficulty, gets up and takes a few shaky steps.