In response to the attack, Fury reactivates the "Avengers Initiative". Agent Natasha Romanoff is sent to Calcutta to recruit Dr. Bruce Banner to trace the Tesseract through its gamma radiation emissions. Coulson visits Tony Stark to have him review Selvig's research, and Fury approaches Steve Rogers with an assignment to retrieve the Tesseract. In Stuttgart, Barton steals iridium needed to stabilize the Tesseract's power while Loki causes a distraction, leading to a confrontation with Rogers, Stark, and Romanoff that ends with Loki's surrender. While Loki is being escorted to S.H.I.E.L.D., Thor, his adoptive brother, arrives and frees him, hoping to convince him to abandon his plan and return to Asgard. After a confrontation with Stark and Rogers, Thor agrees to take Loki to S.H.I.E.L.D.'s flying aircraft carrier, the Helicarrier. There Loki is imprisoned while scientists Banner and Stark attempt to locate the Tesseract.
The Avengers become divided, both over how to approach Loki and the revelation that S.H.I.E.L.D. plans to harness the Tesseract to develop weapons as a deterrent against hostile extraterrestrials. As the group argues, Barton and Loki's other possessed agents attack the Helicarrier, disabling its engines in flight and causing Banner to transform into the Hulk. Stark and Rogers try to restart the damaged engine, and Thor attempts to stop the Hulk's rampage. Romanoff fights Barton, and knocks him unconscious, breaking Loki's mind control. Loki escapes after killing Coulson and ejecting Thor from the airship, while the Hulk falls to the ground after attacking a S.H.I.E.L.D. fighter jet. Fury uses Coulson's death to motivate the Avengers into working as a team. Stark and Rogers realize that for Loki, simply defeating them will not be enough; he needs to overpower them publicly to validate himself as ruler of Earth. Loki uses the Tesseract, in conjunction with a device Selvig built, to open a wormhole above Stark Tower to the Chitauri fleet in space, launching his invasion.
The Avengers rally in defense of New York City, the wormhole's location, but quickly realize they will be overwhelmed as wave after wave of Chitauri descend upon Earth. Banner arrives and transforms into the Hulk, and together he, Rogers, Stark, Thor, Barton and Romanoff battle the Chitauri while evacuating civilians. The Hulk finds Loki and beats him into submission. Romanoff makes her way to the wormhole generator, where Selvig, freed of Loki's control, reveals that Loki's scepter can be used to shut down the generator. Meanwhile, Fury's superiors attempt to end the invasion by launching a nuclear missile at Manhattan. Stark intercepts the missile and takes it through the wormhole toward the Chitauri fleet. The missile detonates, destroying the Chitauri mothership and disabling their forces on Earth. Stark's suit runs out of power, and he falls back through the wormhole just as Romanoff closes it. Stark goes into freefall, but the Hulk saves him from crashing to the ground. In the aftermath, Thor returns Loki and the Tesseract to Asgard. Fury expresses confidence that the Avengers will return if and when they are needed.
In the first of two post-credits scenes, the Other confers with his master3 about the failed attack on Earth and humanity's strength; in the second, the Avengers eat in silence at a shawarma restaurant.