When a prank on a fellow high-school student goes wrong, popular but rebellious Landon Carter (Shane West) is threatened with expulsion. His punishment is mandatory participation in various after-school activities, such as tutoring disadvantaged children and performing in the drama club's spring musical. At these functions he is forced to interact with quiet, bookish Jamie Sullivan (Mandy Moore), a girl he has known for many years but to whom he has rarely ever spoken. Their differing social statures leave them worlds apart, despite their close physical proximity.
When Landon has trouble learning his lines, he asks Jamie for help. She agrees to help him if he promises not to fall in love with her. Landon laughs off the strange remark, believing Jamie to be the last person with whom he would ever fall in love. After all, Landon has access to the prettiest and most popular girls in town; and between her shy demeanor and old-fashioned wardrobe, Jamie doesn't exactly fall into that category.
Landon and Jamie begin practicing together at her house after school. The two form a tentative friendship, and Landon learns that Jamie has a wish list of all the things she hopes to do in her life, such as getting a tattoo and being in two places at once. One day, Jamie approaches Landon at his locker, where he is hanging out with some of his friends. When Jamie asks Landon if they are still on for practice that afternoon he smirks "In your dreams". His friends laugh and Landon's smirk falters as Jamie's face fills with betrayal and embarrassment. That afternoon Landon arrives at Jamie's house, hoping that Jamie will still agree to help him. But she refuses to open the door. When she eventually does, she sarcastically remarks that they can be "secret friends". She slams the door in his face when he agrees. Landon eventually learns the script by himself.
During the play, Jamie astounds Landon and the entire audience with her beauty and voice. Landon kisses Jamie during the play, which was not in the script, and Landon tries to get close to Jamie, but she repeatedly rejects him. It is only after a mean joke played on Jamie by Landon's friends that Jamie agrees to get to know Landon after he punches out Dean and shuns Belinda (his friends who played the joke) and takes Jamie home. The two pursue a relationship. He takes her out to dinner and dances with her, something he never did for anyone else. When he discovers that Jamie has a wish list, he sets out to help her accomplish them. One memorable date had Landon taking Jamie to the state line. He excitedly positions her on the line in just the right way, and when Jamie asks him what he's doing he tells her "You're in two places at once". Her face lights up with joy, as she realizes that Landon set out to make her impossible dreams come true.
Jamie finally tells Landon that she has terminal leukemia and has stopped responding to treatments. Landon gets upset at first. Jamie tells him the reason why she didn't tell him because she was moving on with her life and using the time she had left but then Landon happened and she fell in love with him. Jamie starts to break down as she says to Landon "I do not need a reason to be angry with God." and she flees.
Landon goes to his doctor father's house and asks him to help Jamie. His father freaks out a bit and says that he needs to examine Jamie and know her medical history before he could do anything. Landon leaves in a huff.
Landon and Jamie make up the next day. They hug and he tells her that he will be there for her. Soon, word gets out about Jamie's illness. Eric, Landon's best friend comes and tells him how sorry he is and that he didn't understand. Dean and Belinda both come and apologize.
Jamie's cancer gets worse and she collapses in her father's arms. He rushes her to the hospital where he meets Landon. Landon doesn't leave Jamie's side until her father practically has to pry him away. Jamie's father sits with Jamie and tells her that "If I've kept you too close, it's because I wanted to keep you longer." Jamie tells him that she loves him and her father breaks down.
The next day, Landon comes to the hospital and sees Jamie being wheeled out of there. He asks what's going on. Jamie asks him to thank his father for her. Landon asks Jamie's father what she means. He tells him that his father is going to pay for private homecare for Jamie. Landon is stunned. Late that night, Landon knocks on his father's front door. His father answers. Landon whispers "thank you." His father hugs him. With all the exhaustion and fear billowing over, Landon breaks down in tears in his dad's arms.
Landon continues to fulfill various wishes on Jamie's list, such as building her a telescope so she can see a comet. Through this process, Landon and Jamie learn more about the nature of love. The movie ends with Jamie's death, but only after the couple are married in the same chapel as was Jamie's deceased mother, the event that topped Jamie's wish list. Landon himself becomes a better person through Jamie's memory, achieving the goals that he set out to do, like she did.
Four years later, Landon visits Jamie's father. It is obvious that Jamie helped him to focus and become a better person. For example, he reveals he has finished college and been accepted to medical school; prior to meeting her he had no plans for life after high school. He tells Jamie's father that he is sorry he could not grant Jamie's wish to witness "a miracle" before she died. Her father says "She did. It was you".