In suburban Boston, a young woman (Julianne Hough) leaves her house after being shown in possession of a bloody knife. She is shown moments later buying a bus ticket, her hair now cropped and bleached, and stops at a small town called Southport, North Carolina. At the general store, she introduces herself as 'Katie'. After acquiring a job as a waitress and buying a small house on the edge of town, Katie befriends her next door neighbor, Jo (Cobie Smulders) and meets Alex Wheatley, (Josh Duhamel), the manager of a local convenience store, and his two children, Lexie and Josh. Alex's wife tragically died of cancer a few years prior.
Alex immediately takes a liking to Katie, doing small helpful things, such as leaving an old bicycle at her house. They go on a 'family' trip to the beach, and Alex asks her to go canoeing with him, after which, they fell in love with each other. Lexie immediately accepts Katie, while Josh is initially resistant, believing Katie to be his late mother's replacement, but eventually accepts her as well.
Meanwhile, Kevin Tierney, a Boston police officer, searches for Katie and, using his authority as a police officer, sends out reports saying that she is a wanted murderer. Upon seeing her picture in the police station, Alex confronts Katie and becomes angry that she didn't trust him enough to even tell him her real name, Erin. The picture flashes to Kevin's boss confronting him at work, pointing out he always carries a water bottle that turns out to be filled with vodka, and reveals that Erin was Kevin's wife. Erin/Katie was an abused wife of an alcoholic and sociopath police officer whom she left after he physically beat her a few too many times.
Directly afterward, Katie is shown packing while talking angrily with Jo. Alex drives over to Katie's house to talk to her, only to discover that she left. He drives to the nearest ferry and admits he's fallen in love with her and promises to protect her no matter what. Initially, Katie wants to flee but then she decides to stay in Southport and she and Alex help prepare the town for the upcoming Fourth of July celebration.
Later, Katie tells Alex that Kevin is her husband, whom she stabbed with a kitchen knife in order to protect herself from his drunken assault. Meanwhile, Kevin breaks into Katie's former neighbor`s home back in Boston and finds the phone number to the Southport restaurant that employs Katie. He finds the location and makes his way there, very noticeably drunk. Arriving just on time for the Fourth of July parade, Kevin begins his search for Katie through the crowd, belligerent and determined to confront her. He finally finds Katie and watches from a distance at her dancing with Alex and watches as he leans over to kiss her, which makes him angry. Later, Katie has a dream that she is standing on the docks watching the fireworks when Jo comes up and tells Katie that "he" is here.
Katie wakes up in the convenience store next to a fast asleep Lexie. While she is walking around in the store, Kevin makes his appearance and confronts her, drunk and sobbing and asking her to talk. He asks her to come back to Boston with him, but she refuses and tells him to leave. He pulls out a revolver while Katie asks Lexie to stay up in the second floor of the store, scared that she might see Kevin and become frightened. Meanwhile, Kevin is pouring gasoline all over the store, with the intent to burn it down with Katie inside. He sits down on the steps with a lighter, deep in thought, and Katie fakes sympathy for him and agrees to return home with him, only to push him into the water by surprise. However, a firework spark lands on the gasoline, igniting a fire that spreads all over the store.
Alex, busy shooting off fireworks, sees the burning store and quickly makes his way across the lake by boat. He stands on the dock, pleading with Lexie to jump into his arms. After a brief hesitation, she finally does. Meanwhile, Katie is wrestling with a soaked Kevin who is attempting to shoot her. After a long struggle on the ground with Kevin holding the gun and Katie desperately trying to keep him from pointing it her head, she makes one last desperate grab at the gun and it goes off, killing Kevin. Soon after, Alex finds Katie and they embrace.
In the aftermath, Alex rifles through a desk, whose contents were spared from the fire, belonging to his late wife, where he finds multiple letters she prepared ahead of time for memorable events such as Josh's eighteenth birthday and Lexie's wedding day. Alex gives Katie a letter with the words "To Her" on the envelope. The letter talks about how if someone is receiving this letter, then Alex loves her without a shadow of a doubt. She says she is thankful for whoever is now reading the letter and thanks the reader for making Alex feel young and in love again. The movie ends by revealing that Jo, who had supposedly left town moments before, was actually the ghost of Alex's late wife.