After a hazing incident goes wrong, popular but rebellious Landon Carter (Shane West) is threatened with expulsion. His punishment is participation in various after-school activities, including the spring musical, where he meets bookish, uninvasively religious Jamie Sullivan (Mandy Moore), the only daughter of his mother's (Daryl Hannah) church's pastor, Reverend Sullivan (Peter Coyote). Landon has difficulty learning his lines, so he asks Jamie to assist him. She agrees under one condition: Landon must promise not to fall in love with her. Given her highly conservative manner of dressing and social standing, Landon practically scoffs at the request.
Landon and Jamie begin practicing together at her house after school. As they spend more time together, a friendship begins to develop. Landon is gradually told by Jamie of a wish list of what she aspires to accomplish in life, which includes things like being in two places at once, getting a tattoo and building a telescope. She consistently refuses to tell him her number one wish. However, the fragile rapport is broken when Landon mockingly acknowledges her in front of his popular friends, and Jamie, disappointed by his reaction, refuses to continue the sessions. Landon decides to learn the script on his own, and performs small acts of kindness he hadn't been inspired to do before in hopes of earning Jamie's forgiveness. She remains adamant.
During the scene the two share in the school play, Landon is surprised when Jamie, in an elegant dress and makeup, reveals herself onstage and sings. This, along with a kissing scene, spontaneously added by Landon, seems to make Landon come to a realization concerning his feelings for Jamie, also eliciting jealousy in Belinda, a former girlfriend of his.
In following days, Landon continues trying to approach Jamie, this time as a romantic interest, but she continues to reject him. The breaking point comes when a few of Landon's friends, along with a vindictive Belinda, play a malicious joke on Jamie: a photo-edited flier of Jamie's face pasted on a bathing suit model's body is handed out en masse all over the school. When Landon comes to her aid, renouncing his friends in the process, Jamie finally accepts his advances as sincere and agrees to a date, with her father's begrudging permission. From that day forward, the two begin to fall in love, as Landon helps her accomplish things on her wish list (he takes her to the state line, where she is in two places at once, and gives her a temporary tattoo of a butterfly). He finally learns that her number one wish is to get married in the church where her parents were married. It slowly becomes apparent that Jamie's faith in him has Landon believing in his ability to be a better person: he now wants to go to college and enter medical school where he once merely wanted to flee his small town life.
However, in face of the depth of their relationship, Jamie reveals the secret behind her father's protectiveness to Landon: she has leukemia. She was diagnosed of it two years prior and has long since stopped responding to treatment. She didn't tell him or anybody else because she had resolved to move on with her life normally, her father wanting to spend as much as he could of her remaining time near her. The revelation threatens to tear them apart: Jamie withdraws while Landon despairs, even driving for hours to ask his rich, estranged cardiologist father to help Jamie. After Landon comes to terms with the reality of Jamie's condition and in the face of his insistence in being with her, the pair make up.
With Jamie's cancer advancing, even having her hospitalized, Landon continues to fulfill the wishes on Jamie's list, including building her the telescope. Jamie is released from the hospital, revealing that Landon's father has paid for her to continue receiving private health care at home: Landon once again drives out to see him, and the two reconcile. After watching a comet she had been expecting via said telescope together, Landon proposes to her, unwilling to let her time run out before her number one wish is fulfilled. They marry in the church she had dreamed of, with all their friends in attendance and her father officiating the service. On voice-over, Landon relates that he and Jamie lived out the rest of the summer happily, after which she passed away.
Four years later, Landon is seen visiting Jamie's father, having been accepted into medical school. He expresses his sorrow that Jamie never got to witness a miracle. Reverend Sullivan tells him that she did - it was Landon himself. The film ends with Landon standing on a dock, staring into the sunset, at peace with himself as he thinks about the lessons Jamie taught him.