DMZ, North Korea: Duke (Channing Tatum), Roadblock (Dwayne Johnson), and Flint (DJ Cotrona) are breaking through a security fence, in full view of a North Korean occupied guard tower. Lady Jaye (Adrianne Palicki) is keeping an eye out and Mouse (Joseph Mazzello) is serving as a standby sniper. Roadblock uses some supercharged gloves that get so hot they melt the woven wire fence so the men can get through. On signal, Mouse shoots a coffee mug from the hand of one of the guards to create a diversion and the three scamper on to their destinations. Roadblock and Flint go to where some buildings and vehicles are and they capture/rescue a man from the back of a truck. Meanwhile, Duke has gone directly onto the guard tower and replaced the N. Korean flag with that of the G.I. Joe's.
There's a brief narration explaining how the Joes caught Cobra Commander (Luke Bracey) and Destro (in the previous film), and they are now locked in a maximum security prison. Storm Shadow (Byung-hun Lee) and Zartan (Arnold Vosloo) are still at large. Duke is the captain, charged with leading Roadblock, Flint, Jaye, and the masked mute Snake Eyes (Ray Park). (Note: no mention is made of the Baroness whom is presumed to be still incarcerated).
After completing their mission in Korea, Duke and Roadblock are playing video games at the Roadblock's home. Duke gets jumped on playfully by Roadblock's two young daughters, distracting him from the game as he must stop to wrestle with them.
Duke and Roadblock pause briefly to watch a news story on television about the Pakistani president having been assassinated.
Zartan (Arnold Vosloo), who is impersonating the President of the United States (Jonathan Pryce), meets with his advisors and asks for opinions about what the U.S. should do about the situation in Pakistan. A pentagon general recommends going in. A civilian advisor recommends waiting it out. The Zartan president decides to send the G.I. Joes to Pakistan to capture and neutralize a nuclear device the government had developed so it can't be used by those who assassinated the Pakistani president.
The Joes travel to Pakistan. They are lowered onto the roof of the building where the weapon is located. They fan out and within short order, locate the weapon on the ground floor and start shooting their way into and down the four levels of the structure. Within minutes, they have control of the building and the weapon and remove it from the country. Duke contacts the White House to confirm this.
Zartan enters an underground facility where the Cobras are hiding the real President. Zartan taunts the President and shows off the nanomites that keep his disguise together, by taking a knife and drawing it across his face. The skin changes color but quickly heals itself. Zartan observes that the people of America prefer a President who looks like the real one, but acts like Zartan is acting, bold and aggressive, with a penchant for blowing things up.
At their compound in the desert, Duke and Roadblock make a bet on who can shoot the flame of a candle in a cupcake perched on top of a stick. Duke goes first, but misses because Roadblock keeps talking and taunting him. Roadblock then pulls out a massive machine gun and blows apart the entire cupcake, claiming victory. Duke now has to baby sit Roadblocks two daughters for one night.
Suddenly, the men notice a group attack helicopters approaching and they think maybe it's additional security. However, the helicopters start shooting at the Joes and dropping bombs. They destroy all the vehicles and kill numerous people. The team scrambles for protection while firing back. Duke jumps in to save Flint, but he is killed in an explosion. Roadblock, Flint, and Jaye hide in a deep water well and manage to escape detection.
The next morning, as the trio struggle to climb out of the well, President Zartan addresses the nation regarding the attack. He accuses the Joes of attacking Pakistan and stealing a nuclear weapon. He also accuses Snake Eyes for the assassination of the Pakistani president. Zartan announces on television that the G.I. Joes have been eliminated as a result of all their misdeeds.
Roadblock, Flint, and Jaye finally get out of the water well. As the only surviving Joes, they take off on foot across the desert, set on exacting revenge for their dead.
At a maximum-security prison in Germany, Snake Eyes has been captured and is being taken in to join Cobra Commander and Destro in captivity. He is escorted by Warden James (Walton Goggins) to a room deep underground where he is placed in a tube filled with a liquid medium that paralyzes every part of the body but allows the heart and eyes to remain functioning. James says, "Welcome to hell" and then removes Snake Eye's mask, revealing that it is really Storm Shadow and not Snake Eyes.
A Cobra mercenary known as Firefly (Ray Stevenson) comes roaring up to the facility and sets out little explosive fireflies to break into the place. As this is happening, Storm Shadow makes his heart stop to alert the guards after he's been placed in the chamber. He manages to break out and kill most of the guards. He breaks Cobra Commander from his chamber, but they leave Destro, saying he is out of the band. They meet with Firefly, who comes in as James shoots a gas chamber, causing an explosion. James is killed by the Commander and the explosion's flames severely burn Storm Shadow's back.
Cobra Commander directs that Storm Shadow be taken to a temple high in the Himalayas to recover from his injuries.
In Tokyo, Japan, upon learning that Storm Shadow is alive, the Blind Master (RZA), leader of the Arashikage Clan, sends the real Snake Eyes (Ray Park) and his apprentice Jinx (Elodie Yung), Storm Shadow's cousin, to capture Storm Shadow and get him to reveal Cobra's plans, and also to answer for the murder of his uncle, the Hard Master.
The villains go to an industrial complex where a large weapon known as Zeus is being constructed. President Zartan comes in and informs Cobra Commander about the three surviving Joes. Firefly says they'll be taken care of.
Roadblock, Flint, and Jaye drop by Roadblock's old neighborhood. They take shelter in an old gym/arcade that he used to frequent.
After President Zartan announces that Cobra will replace the Joes as America's main protective unit, Lady Jaye does some technical analysis of the known President's speech pattern and mannerisms with that of the suspected imposter, deducing that someone is impersonating the real president. Flint asks Roadblock who in government they can possibly trust now, and he responds there is one man he knows.
Roadblock leads them to the home of General Joseph Colton (Bruce Willis), the original G.I. Joe. Roadblock explains the situation after showing Colton the dog tags of their fallen brothers. Together, they come up with a plan to prove that the President is a phony.
Colton provides them with weapons, and helps them infiltrate a fundraising event that the President will be attending. Lady Jaye steals a sample of the President's DNA and confirms that he is Zartan. They escape after a brief confrontation with Firefly and Zandar (Matt Gerald), the head of the Presidential Detail and a member of Cobra.
Jaye goes out pretending to be jogging home with her groceries and attracts the attention of a man on the President's detail. She tricks him into helping her out with her groceries, and Roadblock gets him to find them a way to the President.
High in the Himalayas, Snake Eyes and Jinx have located the place where Storm Shadow is being treated. He has healed up by an old woman, and as he is getting dressed following removal of his bandages, he notices that several ninjas are falling past the window from great heights. As he rushes out to see what's going on, he comes across Snake Eyes in the passageway. They engage in a fight, while Jinx appears in the other room and fights the old woman. The old woman and Storm Shadow are subdued after some furious fighting. Snake Eyes and Jinx bundle Storm Shadow into a body bag and fasten the bag to a rope. Numerous ninjas appear and go after Snake Eyes and Jinx in an attempt to rescue Storm Shadow. After numerous battles along the sides of the mountains as they and the Ninjas slide on their ropes and rappel along the rocks, Snake Eyes and Jinx manage to escape. They return to Japan.
Back in Tokyo, Storm Shadow is questioned by Blind Master, who hands him his sword. In this moment, it is revealed that, as a child, it was not Storm Shadow who killed his and Snake Eyes' master, but it was Zartan in disguise as a man who would mentor Storm Shadow into the assassin he became. Storm Shadow reveals that he joined Cobra to avenge his uncle. He gives them the information they want.
Storm Shadow then accompanies Snake Eyes and Jinx as they join the Joes' efforts to stop Cobra.
At the fundraiser that President Zartan is attending, Jaye goes in disguised as a member of the President's detail. She gets in with a sexy red dress and gets Zartan's attention. One of his men, another Cobra ally, is suspicious and starts to do a scan on Jaye's face. She gets out after getting a hair sample from Zartan's coat and sends it to Roadblock. After scanning the sample, they learn Zartan's identity, just as Firefly comes in and tries to attack. He fights Roadblock and almost kills him until Flint and Jaye come by and ram him with their truck. Firefly gets out in time.
In the gym/arcade, Snake Eyes, Jinx, and Storm Shadow come across the Joes, who are initially suspicious, but they join forces. They go back to Colton's place and meet with some of Colton's men to come up with a plan to stop Cobra's plans. Colton shows them his HUGE collection of weapons all over the kitchen and they start preparing.
Firefly is beating the President up in the underground chamber. Cobra Commander comes in with a briefcase that would activate the Zeus weapon and scans the President's eye in order to gain control of the weapon.
Zartan invites the leaders of the world's nuclear powers to a summit at Fort Sumter, where he blackmails them into disabling their nuclear arsenals by first launching America's nukes into the air and then detonating them as they are high above the sky to show his commitment to disarmament. The other world leaders had also launched their missiles and then follow suit in destroying them. It's then that Zartan reveals that he has created Project Zeus: seven orbital kinetic bombardment weapons of mass destruction, that are at his command.
They launch one rod at London, almost completely destroying it, and sending the other world leaders into a frenzy. He threatens to destroy the other capitals if the leaders don't submit to Cobra. By this point, Cobra has officially taken over the White House. Storm Shadow betrays Cobra Commander and kills Zartan, revealing Cobra's deception to the world leaders. While Snake Eyes, Jinx, and Flint fight Cobra's soldiers, Cobra Commander activates the remaining six weapons and instructs Firefly to protect the briefcase containing the launch device. Firefly is killed in combat by Roadblock, who deactivates and destroys the orbital weapons.
Roadblock comes in on a fast attack tank shooting the other villains' tanks while Jaye and Colton go retrieve the President. After shooting their way through dozens of goons, the duo find the underground chamber as one Cobra ally holds the President at gunpoint. Jaye shoots the President in the arm to drop him out of the way and Colton then kills the goon.
Flint goes in pursuit of Cobra Commander, but he escapes on a helicopter, just as his men are preparing for the other Zeus rods to hit other major cities around the world. Roadblock finds that Firefly is holding the briefcase. He nearly escapes on a motorboat, but Roadblock rams into it with another one. He and Firefly begin fighting again, but Roadblock manages to defeat him. At the very last second, he overrides the sequence and causes all the Zeus satellites to explode.
Somewhere underground, after having escaped other ninjas, Storm Shadow finds Zartan pointing a gun at him. He tells Zartan he made him what he has become, and Zartan pulls the trigger, but Storm Shadow slices the bullet in half with his blade and throws it into Zartan's chest. As he dies, the nanomites wear off, and his real face is visible.
Roadblock is walking away from the scene, but Firefly is about to set one of his firefly bombs on him. He reaches into his pocket for his detonator, but Roadblock is holding it. With the push of a button, the firefly explodes, and Firefly is killed. The Joes walk together triumphantly while Storm Shadow respectfully acknowledges Snake Eyes and walks away.
The real President is put back into power and addresses the nation at a ceremony where Roadblock, Jaye, Flint, Jinx, and Snake Eyes are commemorated as heroes. Colton thanks each of them, but when he gets to Roadblock, he presents him with a M1911 pistol that belonged to General George S. Patton, to use when he finally finds Cobra Commander. Roadblock proudly raises the weapon and lets out a single shot in honor of his fallen comrades.