After a rooftop chase, where his acrophobia and vertigo result in the death of a policeman, San Francisco detective John "Scottie" Ferguson retires. Scottie tries to conquer his fear, but his friend and ex-fiancée Midge Wood suggests another severe emotional shock may be the only cure.
An acquaintance from college, Gavin Elster, asks Scottie to follow his wife, Madeleine, claiming she has been possessed. Scottie reluctantly agrees, and follows Madeleine to a florist where she buys a bouquet of flowers, to the grave of Carlotta Valdes at Mission Dolores, and to an art museum where she gazes at Portrait of Carlotta, the subject of which Madeleine resembles. Finally, she enters the McKittrick Hotel, but when Scottie investigates, she is not there.
A local historian explains that Carlotta Valdes tragically committed suicide. Gavin reveals that Carlotta (who he fears is possessing Madeleine) is Madeleine's great-grandmother, although Madeleine has no knowledge of this, and does not remember where she has visited. Scottie tails Madeleine to Fort Point, and she leaps into San Francisco Bay. Scottie rescues her.
The next day Scottie follows Madeleine; they meet and spend the day together. They travel to Muir Woods and Cypress Point on 17-Mile Drive, where Madeleine runs down towards the ocean. Scottie grabs her and they embrace. Scottie identifies the setting of Madeleine's nightmare as Mission San Juan Bautista. He drives her there and they express their love for each other. Madeleine suddenly runs into the church and up the bell tower. Scottie, halted on the steps by his vertigo, sees Madeleine plunge to her death.
The death is declared a suicide. Gavin does not fault Scottie, but Scottie breaks down, becomes clinically depressed and is in a sanatorium, almost catatonic. After release, Scottie frequents the places that Madeleine visited, often imagining that he sees her. One day, he notices a woman who reminds him of Madeleine, despite her different appearance. Scottie follows her and she identifies herself as Judy Barton, from Salina, Kansas.
A flashback reveals that Judy was the person Scottie knew as "Madeleine Elster"; she was impersonating Gavin's wife as part of a murder plot. Judy writes to Scottie explaining her involvement with Gavin's murder of his wife. Gavin had deliberately taken advantage of Scottie's acrophobia to substitute his wife's freshly killed body in the apparent "suicide jump". Judy rips up the letter and decides to continue the charade, because she loves Scottie.
They begin seeing each other, but Scottie remains obsessed with "Madeleine" and asks Judy to change her clothes and hair so that she resembles Madeleine. After Judy complies, hoping that they may finally find happiness together, he notices her wearing the necklace portrayed in the painting of Carlotta, and realizes the truth. He insists on driving her to the Mission.
There, he tells her he must re-enact the event that led to his madness, admitting he now understands that "Madeleine" and Judy are the same person. Scottie forces her up the bell tower and makes her admit her deceit. Scottie reaches the top, finally conquering his acrophobia. Judy confesses that Gavin paid her to impersonate a "possessed" Madeleine; Gavin faked the suicide by throwing the body of his wife from the bell tower.
Judy begs Scottie to forgive her, because she loves him. He embraces her, but a shadowed figure rises from the trapdoor of the tower, startling Judy, who steps backward and falls to her death. Scottie, bereft again, stands on the ledge, while the figure, a nun investigating the noise, rings the mission bell.