While at a multi-country peace summit at a castle in the Swiss Alps, Sim and Watson end up foiling Professor Moriarty's plans to instigate a World War by stopping the assassin (Sim's brother with a face transplant from the face of one of the European diplomats. With the help of a book Sherlock stole from Moriarty detailing his schemes, Mycroft and Mary end up divesting Moriarty of most of his wealth in London. Holmes and Moriarty both visualize how a fight betweene them would ensue, with both concluding that Moriarty would prevail. Accordingly, Sherlock grabs Moriarty and both of them tumble over a balcony and plummet hundreds of feet to their death below while Watson helplessly watches. A few months later, Watson finishes his biography about Holmes, and as he writes THE END, he receives a package containing Holmes' oxygen pump, suggesting that Holmes is still alive. As Watson runs out of the room to investigate who delivered the package, we find Holmes was camoflauged in the writing room the whole time. Holmes goes over to the typewriter, reads the last page of the manuscript, and types a question mark after the words "THE END."
The film begins with brilliant detective Sherlock Holmes (Robert Downey, Jr.) following Irene Adler (Rachel McAdams) - his sometimes lover and nemesis - as she delivers a package to a doctor at an auction. The package turns out to be a bomb. Holmes clears the room, steals the letter the doctor had given to Adler in exchange for the package, and manages to stash the bomb in a place where the detonation won't hurt anyone. Adler promises to meet him later for dinner. While Holmes was busy disposing of the bomb, an unseen assailant assassinates the doctor. Later, Adler meets her boss Professor Moriarty (Jared Jarris), who tells her that she is no longer needed because she loves Holmes, and then he poisons her tea and kills her.
Later on, Dr. John Watson (Jude Law) visits Holmes, where Holmes shows him his new "urban camoflauge" allowing him to blend in with his apartment, a serum that can revive people close to death, and a chart of bombings and acts of violence throughout Europe that Holmes has connected to Moriarty. They go out for Watson's bachelor party as Holmes will be Watson's best man. However, Holmes has only invited his brother Mycroft, a well connected politico, to the party and none of Watson's other friends. As Mycroft and Watson gamble and drink, Holmes finds Madame "Sim" (Noomi Rapace), a gypsy for whom the doctor's letter was intended. She confesses that her brother is being held captive by Moriarty. The letter suggests that her brother will be involved in Moriarty's end-game that Holmes hasn't yet discovered. However, an assasin interrupts and as Holmes fights him off, Sim disappears. Holmes gets a then-hungover Watson to his wedding just on time, where he marries Mary (Kelly Reilly).
Holmes is then invited to see Moriarty. Although Holmes asks Moriarty to leave Watson and Mary out of their inevitable struggle, Moriarty promises to kill them both. Accordingly, Holmes follows Watson and Mary on the train to their honeymoon, and thwarts an assassination attempt of the two of them. Holmes throws Mary off the train into a river, where Myron is waiting in a boat to take her to safety, while Watson agrees to help Holmes defeat Moriarty once and for all. They track down Sim in Paris, and she agrees to help them so long as they rescue her brother. The three are tricked by Moriarty into thinking that he intends to blow up the French opera, when in fact, he blows up a room filled with German dignitaries. While investigating, Holmes discovers that the bomb was actually meant to cover-up a sniper assassination of the head of a huge German munitions company, leading Watson to deduce that his old army-mate/expert sniper Col. Moran is working for Moriarty. They also discover that Moriarty now owns a number of companies owned by now dead businessmen, including the munitions company.
They travel to Germany with the help of Sim's gypsy clan and infiltrate the munitions factory, where Holmes is captured and tortured by Moriarty until Watson rescues him. The gypsies and the duo flee for a nearby train to escape as Col. Moran attempts to have them killed via sniper rifle and heavy artillery. Although a few gypsies are killed, most make it onto the train, where Holmes seemingly dies from his injuries. Watson then remembers the revival serum and injects Holmes with it, bringing him back to life. Holmes agrees to bring Watson home, via Switzerland where diplomats from almost all of the European companies will be meeting at a peace summit to try to avoid war (spurred by all the bombings perpetrated secretly by Moriarty). Mycroft is at the summit to represent Britain, and helps nurse Holmes back to health with his patented oxygen pump and gets the three access to the summit itself in a castle high in the Swiss Alps. Moriarty is also there to act as an arbitrator.
Holmes deduces that Moriarty, with the help of the doctor from the beginning of the film, has perfected a new "face-transplant" medical technique and has replaced one of the ambassadors with Sim's brother. The plan is that Sim's brother will kill the ambassadors, creating a "World War." Holmes goes off to confront Mycroft on his balcony, trusting Watson to have learned enough from him to determine who is the assassin and prevent him from killing anyone. Sim and Watson investigate the entire room, and eventually determine which ambassador is Sim's brother. Sim tries to stop her brother from going through with the plot, but he won't listen, so Watson tackles him and he is dragged out of the room. It is later discovered though, that Col. Moran kills Sim's brother (to ensure no loose ends to connect with Moriarty) the same way he killed the doctor at the beginning of the film, with a blow-dart gun. Col. Moran then disappears in the ensuing chaos.
Meanwhile, Holmes deduces that Moriarty was hoping to profit off the World War by gaining secret ownership of various companies necessary to producing war goods. He says that while Moriarty was torturing him, he pickpocketed his book of plans and sent it to Mary Watson in London, who has helped the police to liquidate all the fraudulent accounts and donate the money to war orphan charities. Moriarty is now penniless and his plan to spur the World War has been defeated (although Moriarty says that, due to human nature, World War will break out eventually even without him). The two of them envision what will happen in a fistfight, with both concluding that due to Holmes' weakened body, Moriarty will prevail. Accordingly, Holmes grabs Moriarty and leaps over the balcony with him, as Watson arrives just in time to see both plummet hundreds of feet to their death.
Some time later, we watch Holmes' funeral. We discover that Watson is writing a biography about Holmes, and he finally finishes his last page typing THE END. Mary admits she misses Holmes too, but looks forward to actually going on a honeymoon with Watson. She gives Watson the mail, including a package. Watson opens the package and discovers the oxygen pump that Holmes used to nurse himself back to health after his earlier near-death experience. Watson runs from the room to try and track down the mail carrier who delivered the package. After he leaves, we find that Holmes has been in the study the entire time in his urban camoflauge. Holmes walks to the typewriter, reads the final page, and then types a question mark after the words THE END.