John "Scottie" Ferguson is a detective in San Francisco. One night, while pursuing a suspect with a fellow cop, Scottie slips from a rooftop and hangs from the ledge. As the cop reaches for his hand, Scottie is unable to grab ahold and the cop falls to his death. Diagnosed with vertigo—the fear of heights—Scottie quits the police force to go into semi-retirement for a while.
Not long after the incident, an old acquaintance, Gavin Elster, contacts Scottie and asks to hire him. His wife, Madeleine, has been experiencing delusions and blackouts that seem to lead her to believe that she is a woman named Carlotta Valdes, a tragic San Francisco figure from the past to whom she is related. Scottie is skeptical of the more occult aspects of this case, but agrees to follow Madeleine, who frequently visits the grave of Carlotta Valdes, a portrait hanging in a museum that depicts Carlotta, and a hotel that was once Carlotta's home. He learns that Carlotta Valdes was married to a wealthy San Francisco businessman and had his child, but was eventually abandoned by the businessman and left to live out her days alone in a large house, in which she went mad. She eventually killed herself. Gavin tells him that Madeleine is related to Carlotta, but does not know.
One day, Scottie follows the beautiful Madeleine to the Golden Gate Bridge, where she abruptly jumps into the San Francisco Bay. He jumps in after her and scoops her out, taking her home and letting her recover in his bed. When she awakens, he introduces himself and the two develop romantic chemistry, until Madeleine leaves abruptly.
Madeleine visits Scottie the next day to deliver a thank you note, and he asks her if she wants to go "wandering" with him. She agrees and they travel to Muir Woods. There, she tells him all about her surreal dreams, in which she believes she is Carlotta Valdes, and which seem to suggest she is going mad and will inevitably kill herself. When Scottie tries to comfort her, the two of them fall into an embrace, professing their love for one another. Madeleine tells him about a recurring nightmare she has that takes place at the Mission San Juan Bautista.
The couple goes to the mission, and Madeleine runs to the top of the bell tower. Scottie runs after her, but experiences vertigo on the way up the stairs and is too late; Madeleine throws herself off the tower to her death. The death is ruled a suicide, and Scottie falls into a deep depression, feeling responsible for yet another death, and is placed in a sanatorium. His old friend and former fiancée, Midge, comes to visit him, and decides that he is still in love with Madeleine.
When Scottie is released from the sanatorium, he wanders the streets looking for memories of Madeleine. One day, he spots a woman who looks very much like Madeleine, but has brown hair and a completely different style. He follows the woman back to her hotel and discovers that her name is Judy Barton. He asks her to come to dinner and she agrees. When Scottie leaves the room, however, we learn that Judy is in fact "Madeleine." In a flashback, we see that Gavin Elster killed his wife, and then hired Judy to pose as his wife in order to stage the death scene that would ensure his actual wife's death be ruled a suicide. Judy writes Scottie a letter, explaining everything and apologizing, but then abruptly rips it up, opting to not tell Scottie about her true identity.
After Scottie and Judy have been seeing each other for a short while, Scottie becomes obsessed with transforming her into Madeleine. He obsessively shops for the clothes that Madeleine wore, and insists that she dye her hair blonde and wear it in the way Madeleine did. One night, when they are going out to dinner, Scottie sees that Judy is wearing a necklace that Madeleine had, and he realizes what happened. Without telling Judy that he knows, he takes her to the mission in the middle of the night, and drags her up to the bell tower, forcing her to confess to the deception. They try to reconcile, when they are interrupted by a nun who heard their voices. Judy is terrified and falls off the bell tower to her death.