Peter Parker struggles to balance his crime-fighting duties as Spider-Man with the demands of his normal life. He loses his job, faces financial difficulties, and struggles to maintain his physics studies at Columbia University. Moreover, he has become estranged from both love interest Mary Jane Watson, who to Peter's disappointment is in a relationship, and best friend Harry Osborn, who falsely accuses Spider-Man of murdering his father Norman Osborn. Peter additionally discovers his Aunt May is threatened with foreclosure.
Harry, now the head of Oscorp's research division, sponsors the brilliant nuclear scientist Otto Octavius, who dreams of perfecting sustained fusion power, and wears a harness of powerful robotic tentacle arms with artificial intelligence while conducting his research. When a power spike causes an experiment to quickly destabilize, Octavius stubbornly refuses to shut the experiment down, leading to disastrous consequences: his wife is killed, the neural inhibitor chip which keeps the arms from influencing his mind is destroyed and the arms are fused to his spine. Spider-Man arrives and shuts down the experiment before it can do any further damage.
At a hospital, doctors prepare to surgically remove Octavius' arms and harness, but the arms, having developed sentience from the inhibitor chip's destruction, spring to life and murder most of the medical crew. Upon regaining consciousness and seeing the carnage, Octavius escapes and hides at a harbor. The arms convince him to retry the experiment. To fund it, Octavius—now called "Doctor Octopus" by the Daily Bugle—robs a bank.
After Peter misses Mary Jane's debut play, she, in retaliation, becomes engaged to astronaut John Jameson, son of Bugle chief J. Jonah Jameson. Peter is devastated, and this, in addition to all the other stress factors in his life becomes too much, causing him to lose his powers. He abandons his Spider-Man identity and returns to his normal life while trying to reconcile with Mary Jane.
A garbageman brings Spider-Man's costume to J. Jonah Jameson, who blames himself for Spider-Man's disappearance. Peter tells Aunt May that his Uncle Ben's death some time ago was partially his fault. Although initially shocked, May quickly forgives him, but when his nine-year-old neighbor mentions Spider-Man's disappearance and the subsequent rising crime rate in New York City, Peter begins pondering if abandoning his Spider-Man identity was a wise choice. Octavius needs tritium to fuel his reactor and goes to Harry to demand it. Harry initially refuses because the experiment threatens to level the city, but he eventually agrees in exchange for Spider-Man and tells him that Peter, who is supposedly good friends with Spider-Man, is the key to finding him. Octavius finds Peter, tells him to find Spider-Man, and abducts Mary Jane. Peter realizes his powers are restored due to the trauma of seeing Mary Jane kidnapped, and dons his costume again after stealing it from the Bugle.
As Spider-Man battles Octavius, they fall onto a rapid transit R train. Octavius disables the controls and jumps off. Spider-Man stops the train before the track ends. When he faints from exhaustion, the passengers carry him into one of the cars. He comes to and realizes his mask is off, but the passengers are so grateful they vow not to reveal what he looks like. Octavius returns, demanding Spider-Man, and subdues the passengers. After knocking out Spider-Man, Octavius delivers him to Harry.
After giving Octavius the tritium, Harry prepares to kill Spider-Man, and is shocked to see it is really Peter. Peter convinces him greater things are at stake, and Harry reveals Octavius' location. Spider-Man arrives at the doctor's waterfront laboratory and tries to rescue Mary Jane discreetly. One of Octavius' tentacles senses him, and they fight. Spider-Man ultimately subdues Octavius, reveals his identity, and convinces Octavius to let go of his dream for the greater good. Octavius finally commands the tentacles to obey him and drowns the fusion reactor, along with himself, in the Hudson River. Mary Jane discovers Spider-Man's true identity, as well as why they cannot be together. Peter returns Mary Jane to John and leaves.
Harry is visited by a vision of his father, pleading for Harry to avenge his death. Refusing to hurt Peter, Harry shatters the mirror, revealing a secret room containing the Green Goblin's equipment and performance enhancers. On her wedding day, Mary Jane abandons John at the altar and runs to Peter's apartment, where she admits her true feelings for Peter. They kiss, and after hearing police sirens, she encourages him to respond as Spider-Man.