When a prank on fellow high-school student Clay Gaphardt 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 the drama club, where he is forced to interact with quiet, kind and 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. They begin practicing together at her house after school. At first Landon is only using Jamie for her help with the play, and treats her coldly when his other friends are around. But as he spends more and more time with her, he is surprised to find she is far from the person he thought she was, and begins to question whom he really wants to impress.
During the play, Jamie astounds Landon and the entire audience with her beauty and voice, and Landon kisses her on the stage. Afterwards, he tries to get closer to her, but she repeatedly rejects him. Soon thereafter, however, Landon's friends go out of their way to cruelly mistreat Jamie, and he confronts them immediately, publicly siding with her. Afterwards, they start seeing each other, with Landon dedicating most of his time to her. He discovers she has a wish list, and sets out to make all her ambitions come true, such as taking her to a state border so that she can stand on either side of the line and, thus, be in two places at once.
In the final stretch of the movie, Jamie confesses to Landon that she is afflicted by terminal leukemia and has stopped responding to treatments. Landon gets upset at first, and Jamie tells him the reason why she didn't tell him is that 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.
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. Other friends come and apologize too.
Jamie's cancer gets worse, her father 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."
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."