NOTE: This spoiler was submitted by Jeremy
The film starts on Acidalia Planitia, the landing site of the shuttle Ares III on Mars. The Hermes crew - led by Commander Melissa Lewis (Jessica Chastain), along with Mark Watney (Matt Damon), Beth Johanssen (Kate Mara), Rick Martinez (Michael Pena), Chris Beck (Sebastian Stan), and Alex Vogel (Aksel Hennie) - are gathering their samples before re-entering their vessel.
The crew learns that an intense storm is about to pass through. Choosing to go on with their mission, Watney opts to wait it out. The crew heads out in their suits as heavy winds and sand gusts him them. A piece of debris breaks off and strikes Watney, knocking him out of sight from the crew. Lewis tries to guide the others to find Watney, but the storm is way too strong for them to keep going. They head back into the vessel without Watney and fly back into space.
Back on Earth, Director of NASA Teddy Sanders (Jeff Daniels) holds a press conference to state that while the Hermes crew succeeded in their mission, Watney was lost, and he is declared dead.
Watney wakes up on Mars on what is Sol 21 (mission day) after the storm has long passed. His oxygen is depleting rapidly, so he makes his way back to the habitat station. Hes also been impaled by an antenna in his abdomen. Watney pulls it out and then staples the wound shut. He sits down to make a video log where he states that he's alive, and how he acknowledges that it'll be another four years before a manned mission is launched to bring him back, and with the current food supply in the habitat meant for him and the other five crew members, he would have almost a year's worth of food to last him, and a little longer if he rations. Therefore, Watney determined that he has to grow three years worth of food on a planet where nothing grows. Luckily for him, he's a botanist.
At NASA, engineer Vincent Kapoor (Chiwetel Ejiofor) talks to Sanders over trying to get another mission funded to bring Watney back without compromising the missions of the next two Ares launches. Sanders refuses. Later, another engineer named Mindy Park (Mackenzie Davis) meets with Kapoor after they discover satellite photos from Mars that are a minute apart, where they see movement detected. They bring in Sanders and Director of Media Relations Annie Montrose (Kristen Wiig) to prove that Watney is still alive.
A few Sols later, Watney has managed to grow potato crops using waste from the crew as fertilizer (to his disgust), while also burning hydrazine to make water. As he continues to work on his food supply, he keeps going with the video logs and decides to use a rover to make it to the Schiaparelli crater that will be the landing site for Ares IV in four years. Since the rover can only take him so far, he gets by using solar cells and an extra battery.
Watney tests the rover to find the Pathfinder probe to get in touch with NASA. Using a code, he is able to send a message to NASA confirming that he is alive. Kapoor and his colleagues receive the message and manage to get in touch with Watney through computer messages. When Watney asks how the crew took the news of him still being alive, Kapoor regretfully tells him that the crew still has no idea, prompting Watney to write obscenities (which are also broadcast all over the world).
Watney's story becomes a worldwide sensation. His communications with NASA are logged, and he even has a photo taken for publishing, which Montrose doesn't like because she can't see his face.
The Hermes crew has been spending the last few months enjoying the ride back to Earth while also keeping in touch with their loved ones. The flight director of Ares III, Mitch Henderson (Sean Bean), contacts the crew and informs them that Watney is alive, and that they've kept it from them for the last two months so as to not distract them from their mission. The news only makes them angry and guilt-ridden, but Henderson tells them that Watney has stressed repeatedly that it wasn't their fault and they had reason to suspect that he was dead.
The folks at NASA determine that they can reach Watney by Sol 868, and with the amount of food he's grown, it can last him way past that.
Things go south for Watney when he enters the habitat, and the airlock decompresses, blowing out a good portion of his crops and causing his helmet to crack. He gets a bunch of duct tape to seal the crack. With less food, he figures he only has enough food to last him past 300 Sols, and possibly longer if he rations, but it would mean starving himself.
NASA quickly launches a probe to resupply Watney. Moments after launching, it explodes. Two directors from the Chinese National Space Administration, Zhu Tao (Chen Shu) and Guo Ming (Eddy Ko), witness the explosion and plan to help NASA by sending a probe themselves with Watney during the Ares IV launch.
We meet astrodynamicist Rich Purnell (Donald Glover). While a bit absent-minded, he devises a plan that would get the Hermes crew to turn around and go on an extended space trip to get Watney back while also being able to intercept the Chinese probe and get the supplies for Watney. Sanders refuses to go through with this plan, but Henderson secretly sends the plan to the crew. Despite knowing that they could get in trouble for defying orders, Lewis decides they must go back for Watney.
Seven months pass on Mars. Watney has lost a lot of weight, has grown a lot of facial hair, and his teeth are rotting. He's started losing hope in his survival and rescue. He sends a video log to anyone who can let his parents know of his fate. Still, he continues to work on the rover to take him to the crater where he locates the Mars Ascent Vehicle.
After the Hermes crew has orbited around Earth and collected the supplies, they are ready to get Watney back. NASA and the rest of the world watch with anticipation. Watney launches the MAV into orbit, but he comes up too low to reach the shuttle. The crew uses an explosive to slow the shuttle down without wasting fuel so they can still get Watney. Lewis uses a tether to get close enough to reach Watney, but she can't. Watney then punctures a hole in his suit to propel himself toward Lewis. He misses her but grabs the tether, which he uses to pull himself and Lewis back toward the shuttle. Lewis announces to NASA that they got Watney, and everyone all over the world cheers. The crew hugs Watney and jokes about his stench.
A while later, Watney begins Day 1 as an instructor to aspiring astronauts. He tells them of his struggle on Mars, and reminds them that if things should go south for them, that they could either accept their fate or work toward fixing it.
During the initial credits, we see the characters years later as they watch the launch of Ares V, which Martinez is part of. Kapoor, Montrose, Park, and Sanders watch from NASA. Lewis watches at home with her husband, while Vogel is at home with his family. Beck and Johanssen have gotten married and just had a kid at the hospital where they watch as well.