Sherlock Holmes (Robert Downey, Jr.) is investigating a seemingly unrelated series of crimes around Europe, believing them all connected to Professor Moriarty (Jared Harris), a criminal mastermind just as smart as Holmes. After Moriarty arranges for another assassination, he poisons Irene Adler (Rachel McAdams), as her feelings for Holmes have compromised her usefulness. Meanwhile, Holmes takes Dr. Watson (Jude Law) out with his brother Mycroft (Stephen Fry) for Watson's stag party, and saves another intended victim of Moriarty's, a fortune telling gypsy named Sim (Noomi Rapace). Holmes meets with Moriarty, who warns Holmes that if he persists in investigating him, Watson will become a target. Holmes stows away on the train taking Watson and his new wife Mary (Kelly Reilly) to their honeymoon destination, knocking Mary off the train to the safe hands of Mycroft while he and Watson battle Moriarty's men. When the duo arrive in France, Holmes tells Sim that Moriarty targeted her due to her brother Rene's work with him, and she was a loose end.
In Paris, Holmes, Watson, and Sim go to the opera where they believe Moriarty will strike, but Holmes realizes too late that Moriarty has deceived him; a hotel is blown up instead and several businessmen are killed. As Holmes looks over the bodies, he notices that one of the men was actually shot in the head by a sniper seconds before the explosion. He concludes that the explosion was a cover-up for the shooting, carried out by sniper-for-hire Colonel Sebastian Moran (Paul Anderson).
Tracking the killed man's ownership of an arms factory in Germany which has recently been bought out by Moriarty, Holmes and Watson investigate, but Holmes is captured. Moriarty reveals he owns shares in companies across Europe in cotton, guns and other goods, and plans to start a war that will create a large demand for them and make him a tidy profit. Watson rescues Holmes and the two escape the factory on a passing train. Holmes surmises Moriarty's next target is a peace summit, where he will create an incident between world leaders to spark war.
At the summit with Mycroft, Holmes deduces that a set of twins working for Moriarty are not actually twins, and were an experiment to give a man the face of another. Realizing that Rene has been made to look like one of the party guests and will act on Moriarty's behalf, Watson and Sim find out which guest he is while Holmes invites Moriarty to a game of chess on a balcony over a waterfall. Watson and Sim successfully stop Rene, but he is killed by Moran. Meanwhile, Holmes reveals to Moriarty that in Germany he stole an account book tracing all of Moriarty's assets, the only piece of evidence linking him to his deeds, and Mary has taken it back to London with a cipher discovered by Holmes, where Inspector Lestrade (Eddie Marsan) is confiscating all his illegal possessions.
Holmes and Moriarty mentally plan a battle and both realize Holmes will lose; with no other option, Holmes blows soot from his pipe in Moriarty's eyes, distracting him so Holmes can grab him and knock both of them off the balcony and into the waterfall seemingly to his death. Some time later, Watson and Mary prepare to go on another honeymoon while Watson finishes writing of his last case with Holmes. A delivery of Mycroft's oxygen breathing device alerts Watson that Holmes survived, and he runs to question Mary about the delivery while Holmes reveals himself concealed in Watson's room, rushes to the typewriter and adds a "?" after the words "The End".