Abandoned by his parents and raised by an aunt and uncle, teenager Peter Parker (Andrew Garfield), AKA Spider-Man, is trying to sort out who he is and exactly what his feelings are for his first crush, Gwen Stacy (Emma Stone). When Peter finds a mysterious briefcase that was his father's, he pursues a quest to solve his parents' disappearance. His search takes him to Oscorp and the lab of Dr. Curt Connors (Rhys Ifans), setting him on a collision course with Connors' alter ego, the Lizard.
The Other, the head of the Chitauri extraterrestrial species, is met by the Asgardian Loki. The Other promises Loki an army with which he might conquer Earth in exchange for returning the Tesseract,[N 2] a formidable energy source of unknown potential. S.H.I.E.L.D. director Nick Fury visits a remote research site where physicist Dr. Erik Selvig is in charge of a team performing experiments on the Tesseract. In an instant, the Tesseract ignites and creates a wormhole, enabling Loki to travel to Earth. Other agents, including Clint Barton, help Loki enslave Selvig after he steals the Tesseract and uses his sceptre to do so.
Fury reacts by resuming the "Avengers Initiative". Dr. Bruce Banner will be hired by Agent Natasha Romanoff in Kolkata to locate the Tesseract using its gamma radiation emissions. In order to collect the Tesseract, Fury approaches Steve Rogers, while Agent Phil Coulson meets Tony Stark to ask him to verify Selvig's findings. When Barton steals the iridium required to stabilise the Tesseract's power while Loki is in Stuttgart, a fight with Rogers, Stark, and Romanoff results in Loki's submission. As Loki is being led to S.H.I.E.L.D., his adoptive brother Thor shows up and frees him in an effort to persuade him to change his mind and go back to Asgard. Loki is captured and transferred to S.H.I.E.L.D.'s flying aircraft carrier, the Helicarrier, after Stark and Rogers step in and stop the attack.
The discovery that S.H.I.E.L.D. intends to use the Tesseract to create potent weapons as a deterrent against hostile extraterrestrials causes the Avengers to split over how to handle Loki. The Helicarrier is attacked by Loki's agents as they quarrel, and the tension prompts Banner to turn into the Hulk. While Thor tries to halt the Hulk's fury, Stark and Rogers work to restart the damaged engine. By knocking Barton down cold, Romanoff dismantles Loki's mind control. After killing Coulson, Loki flees, and Fury uses Coulson's passing to spur the Avengers to band together. Loki launches his invasion by opening a portal above Stark Tower to the Chitauri fleet in space using the Tesseract and a wormhole generator Selvig created.
When the Avengers get together to defend New York City from the Chitauri, they are joined by Rogers, Stark, Romanoff, Barton, Thor, and the Hulk. Loki is beaten into surrender by The Hulk. Selvig, now free from Loki's mind control, explains that Loki's sceptre has the power to turn off the generator as Romanoff makes her way to it. The World Security Council officials in charge of Fury try to stop the invasion by aiming a nuclear missile towards Midtown Manhattan. Stark deflects the rocket and directs it onto the Chitauri fleet via the wormhole. The Chitauri mothership is destroyed as the missile explodes, neutralising their troops on Earth. The Hulk saves Stark when his suit loses power and he falls to the ground. After that, Thor travels back to Asgard with Loki and the Tesseract where Loki will face their justice.
The Other consults his master about the unsuccessful attack on Earth in a sequence at the middle of the credits.