San Andreas begins with a young woman driving on a cliffside in the San Fernando Valley of California. Rocks pummel her car from the above cliff and force her off the road. Ray Gaines (Dwayne Johnson), the film's protagonist, is flying a helicopter for the Los Angeles Fire Department's search and rescue division. With a journalist inside the helicopter, Ray navigates the chopper into the dangerous ravine. He and his crew lower themselves on ropes to rescue the woman from the teetering car before it drops hundreds of feet.
Dr. Lawrence Hayes, a seismologist at Caltech, ends a lecture on history's most destructive earthquakes. His colleague, Dr. Kim Park, notifies him of seismic activity in Nevada. Excitedly, the two decide to investigate the tremors at the Hoover Dam. Meanwhile, Ray plans to drive his daughter Blake the next day to her new university in Seattle. He speaks with her on the phone as he gets home from work and finds divorce papers from his ex-wife. He goes to his daughter's old room and looks through photos of a trip the family once took to San Francisco.
Dr. Hayes and Dr. Kim are at the Hoover Dam, confirming their findings on location. Suddenly, their computer readings spike and a 7.1 magnitude earthquake rips through the area. The damn breaks as Hayes rushes people off it, while Kim climbs from the inside of the dam. On his way to safety, Kim rescues a frightened girl and throws her into Hayes' arms, sacrificing himself as the dam collapses with him. Meanwhile, Ray receives news from the chief that he is needed in Nevada to respond to the quake. He pockets his phone and arrives at the home of Daniel, his ex's new boyfriend, who he is meeting for the first time. He informs Blake he can't drive her after all, and Daniel offers. Ray also learns during the conversation that Emma is moving in with Daniel. Ray drops off Blake's bicycle and leaves in a huff.
Blake flies in Daniel's private jet to San Francisco, where he has business to attend to as a property developer before they head further north. He tells her he doesn't intend to get in the way of her relationship with her father. They drive to Daniel's office tower, where Blake waits in the lobby until his meeting is over. She meets Ben, a nervous English man her age who is there to interview for a job. His little brother Ollie is there too; he comments on Blake's beauty and asks on his brother's behalf for her phone number.
Emma is at lunch at the top of the Marriott in downtown Los Angeles when Ray calls from his helicopter. He apologizes for his attitude the day before. Suddenly, an earthquake rips through the city. Ray orders her to get herself to the roof and says he will come to her. As the surrounding buildings collapse, Ray saves Emma by pulling her into the helicopter on a rope.
In San Francisco, Blake and Daniel are leaving the parking lot of his building when the earthquake strikes. A falling beam kills the driver; the beam also pins Blake's legs under the driver's seatback. Daniel runs from the parking lot to get help, finding a security guard inside the building to let him know. Ben and his brother overhear; they realize it is Blake. A chunk of floor falls on the guard, sending Daniel into a daze. He staggers out of the building, leaving Blake.
Ben and Ollie find Blake and get her unstuck by using a carjack to lift the concrete that pins her. Once outside, they find an electronics store and Blake wires together a means of phoning her father while the cellphone signals are down. Ray says he will fly up to San Francisco to rescue her. They agreed to meet at Coit Tower, where they once celebrated a birthday. She is surprised to learn her mother is with him, and tells Emma that Daniel left her. Emma calls Daniel and leaves a voicemail: she says if he isn't dead, she's going to kill him. She and Ray smile.
While flying north, Ray's helicopter sputters with a gearbox failure. This forces him and Emma into a crash landing at a mall in Bakersfield. Around them people are looting amid the earthquake chaos. They steal a truck after Ray takes the gun of a man threatening him. Ray and Emma discuss while driving how the death of their other daughter, Mallory, led Ray to become emotionally closed off to her. He says he doesn't want to talk about it, and Emma says that's why she left. They drive until they reach a point in the road where the San Andreas fault has split open the ground. With no way around, they trade their stolen truck to a couple whose car has broken down. In exchange, the couple show them to a small airplane in a hangar. Before they take off, Ray apologizes for not dealing with his grief better. He says he feels responsible for Mallory's drowning, as it was his idea to go rafting with her. Emma says if he couldn't save her, no one could.
Ray and Emma fly to San Francisco. Meanwhile, Blake, Ben and Ollie see that flames and destruction surround the Coit Tower. They turn around and head for Nob Hill as another high point. Realizing that there is nowhere to land, Ray and Emma tandem parachute from the plane, landing in the middle of the baseball field at AT&T Park stadium. A 9.6 magnitude earthquake strikes just as they leave the stadium: Ray ushers everyone he sees to take shelter next to a stadium wall. Meanwhile, Blake, Ben and Ollie are still alive, but Ben has a shard of glass in his leg, which Blake removes. They keep walking.
Ray and Emma see the city isn't traversable, so they take a boat from the dock nearby and navigate through the bay to Coit Tower. Upon seeing it, they realize Blake must be somewhere else. Suddenly, the water level shifts, and Ray and Emma realize a tsunami is approaching. Blake, Ben and Ollie make the same realization, and they run up the stairs of a building Daniel's company was building.
Ray and Emma drive their boat toward the tsunami, making it over the massive wave before it crests. However, they narrowly escape being crushed by a container ship being flipped over by the wave. The ship crushes the Golden Gate Bridge, where Daniel is standing.
Once the tsunami's damage has finished, the city is in ruins and the building Blake is in floods. Ray and Emma find their way to her and the boys, but Blake becomes trapped underwater as tsunami waters continue to flow in. Ray dives under and swims into the building. Blake loses consciousness while trapped behind a panel of glass, and Ray pulls her out. Emma drives the boat through a window to reach the others. They drive away as the building collapses. Out in the calmer water, Ray cannot revive Blake. Emma cries over another lost daughter. Suddenly Ray tries again to perform CPR, this time bringing back Blake's breathing.
Dr. Hayes and the journalist congratulate each other for getting out the message in time to save many lives. The news reports on FEMA and other recovery volunteers coming to California to assist victims of the earthquake. At a recovery camp, Ray and Emma have reconciled their marriage, and Blake and Ben seem to have begun a relationship as well. An American flag unfurls over the destroyed Golden Gate Bridge as the group of survivors stand in the sunset light together. Emma asks what is next, and Ray says, "We rebuild."