The pre-title teaser takes place in an unidentified Latin American country: James Bond infiltrates a military airbase in order to plant a bomb on a secret radar system, however he is quickly captured by the same officer that he impersonates. As his captors drive him off the base, Bond's female assistant distracts the guards enough for the agent to escape. Using an Acrostar mini-jet, Bond attempts to fly out of the country. A missile is launched from a nearby battery and streaks towards his plane. Bond is unable to outmaneuver the missile at first but is able to lure it into the aircraft hangar where he'd previously failed to destroy the radar system: he flies straight through it, trapping the missile inside and destroying the hangar. As he streaks away, Bond sees that he is nearly out of fuel. He lands near a gas station and cheerfully asks the attendant to "Fill her up, please."
In East Germany a clown is fleeing a circus, with two knife-throwing twins in pursuit. As he tries to escape at a border crossing into West Germany, one of the twins hits him in the back with a throwing knife and he falls into a river and is washed away. The man survives the attack and stumbles into the British embassy. He crashes through a glass door and falls dead, a jeweled egg rolling from his hand.
In London, Bond reports to his MI6 superior, M, who tells him about the recovered egg which was made by Carl Faberge for the Russian royal family. M informs Bond that the egg is a very elaborately constructed fake and that the real egg is up for auction. He also informs Bond that the man who turned up dead in East Berlin was Agent 009.
In a situation room somewhere in the USSR, a group of Soviet officers and state officials meet about the current peace and disarmament talks between themselves and the rest of Western Europe. A combative General, Orlov, presents a plan to the committee where he would lead a fast incursion with tank divisions into Western Europe through Eastern Germany and Czechoslovakia. Orlov's belief is that the disarmament talks are weakening the Soviet army's numerical advantage. The plan is dismissed by the rest of the committee as far too extreme. Orlov sulks and receives a message to report to the Ministry of Antiquities. When he arrives, he gets the news about the stolen egg. He orders one of the twins who killed 009 to have the real egg purchased.
Back in London, Bond attends the auction with MI6s antiquities expert and, during the tense bidding for the egg where Bond himself drives up the price, switches the fake for the authentic one. The bidder who wins the egg is a wealthy Afghani exile named Kamal Khan. Bond follows him to Delhi in India.
Bond goes to his hotel's nightclub to meet Khan socially. Khan seems unbeatable in backgammon until Bond steps up and wagers the authentic egg. Bond exposes Khan's method of cheating; he uses loaded dice, which Bond seizes and uses to his own advantage, winning a large sum of money in the bargain. As he reports to MI6's safe house, he is attacked by Khan's henchmen, one of them is his personal bodyguard, the turbaned giant, Gobinda. Bond and his Indian Secret Service contact, Vijay, evades his pursuers during a furious chase through a bazaar and finds himself in Q's lab. Q plants a tracking device on the egg and synchs it to Bond's wristwatch.
Later, at his hotel, Bond meets another of Khan's operatives, a beautiful woman named Magda, who tells Bond he may trade the egg for his life. Bond sleeps with her, knowing she'll steal the egg. While they're in bed, Bond notices she has an elaborate tattoo of a blue-ringed octopus. Magda escapes Bond's room and is picked up by Khan. Gobinda appears and hits Bond, rendering him unconscious.
Bond awakes in Khan's palace and Gobinda informs him that he will attend dinner at 8pm. At the meal, Bond asks why he's being held captive when Khan already has the egg. Khan intends to torture Bond to find out what he knows and which British agency he is working for. Following dinner, Bond escapes from his room and makes his way to the lower chambers of the palace where he finds Khan meeting with Orlov, however, the details about the egg are still unclear but it appears to be a form of payment. He also hears the name of a East German city, Karl-Marx-Stadt. Orlov orders Khan to kill Bond. When Khan finds out that Bond has escaped his confinement, Khan orders a hunting party formed. Bond is able to evade them and the dangers of the nearby jungle.
Bond reports to Q who supplies him with a motorized fake alligator which allows him to infiltrate the mysterious floating palace, inhabited only by beautiful women and their secretive leader. He finds a woman, Octopussy, who leads the Octopus Cult, women who are assassins and thieves, who pose as circus performers. She and Bond actually share a connection; her father was a thief whom Bond had tracked years before, however, before Bond could arrest the man, he killed himself and the gold the man had looted was never found. Khan himself suddenly appears, saying that Bond had escaped, however, Octopussy tells Khan that the agent is staying with her. Khan leaves, silently furious at the turn of events. He hires a small group of assassins to infiltrate Octopussy's compound, stressing that Octopussy herself is not to be harmed. Before the assassins make it to the island, they kill Vijay, who'd been on stakeout nearby.
Bond snoops around Octopussy's private study and finds a flyer for her circus. She walks in the room and tells Bond she'll be going away for a week. Bond suspects that Octopussy will be going to Karl-Marx-Stadt with Khan. He and Octopussy quarrel a bit when Bond says he may not be there when she returns. The two make love; while in bed together they are attacked by assassins after Bond. Bond and Octopussy thwart them all, however Bond is forced out a window and into the river. He appears to be eaten by an alligator, however it is the same false one he used to infiltrate the palace. Returning to the stakeout point where Q and Bond's Indian contact, Vijay, had been waiting for him, Bond finds Q with the murdered Vijay. Before he died, Vijay confided in Q that he was attacked by Kamal's men. Bond tells Q to contact M and inform him that he needs to travel to Karl-Marx-Stadt.
Bond travels to West Berlin to meet with M on the situation. From there, Bond travels into East Germany and secretly attends Octopussy's circus. The next day, Bond poses as a circus employee where he soon discovers that the Faberge egg is part of a cache of priceless jewelry being used to pay Orlov for a stolen Soviet nuclear bomb that will be detonated on the American airbase at Feldstadt in West Germany. The nuclear explosion will be planned to look like an accident by the United States - the bomb will be housed in the cannon from the human cannonball stunt in the show, which will also make smuggling it over the East/West German border easier. Orlov hopes that NATO will order nuclear disarmament throughout Europe so that he may make his lightning armored strike through the Iron Curtain and invade Western Europe.
Meanwhile, the fake jewelry has already been delivered by Orlov to the Moscow Ministry of Antiquities to take the place of the stolen items. Orlov's superior, General Gogol, having discovered that the jewelry in Moscow is bogus, immediately departs for the East-West German border to apprehend Orlov.
Bond is able to find the train car with the cannon where the jewelry is also hidden for smuggling purposes. The jewelry is being removed from one cannon and being placed into another - Khan and Orlov have been working together to double-cross Octopussy from the beginning. Bond finds one of the twin knife-throwers making the switch and kills him, hiding the body in the cannon's barrel and donning his clothes. Bond interrogates Orlov when the latter arrives to inspect the work, finding out his plan for conquering Europe. Bond is forced to retreat when Soviet guards come to aid Orlov and he steals Orlov's car. During a brief chase, the tires on Orlov's car are shredded and Bond drives onto the train tracks in pursuit of the train itself. He manages to board the train with Orlov in pursuit.
Bond hides in the cannon car inside a gorilla suit. The train is stopped at the West/East German border and the border guards from both countries search the train, finding neither Bond in the gorilla suit or the bomb in the stage cannon. When the train resumes, Orlov drives to the border and attempts to flee on the train by chasing after it on foot. When he crosses the border illegally, the border guards open fire and fatally wound him until Gogol arrives. Standing before the dying Orlov, Gogol ridicules him as being a nothing but a "common thief", but with his last breath Orlov vows to be made Hero of the Soviet Union by tomorrow.
On the train, now traveling through West Germany, Bond witnesses Khan and Gobinda arming the bomb by setting a timer to detonate it in four hours at 3:45 pm when the stage cannon will be used. Gobinda hears a clang in the room caused by Bond while hiding in a gorilla suit. He follows Bond to the roof of the train where they battle briefly. The brother of the twin that Bond killed finds them both but realizes that Bond is not his brother. The two fall off the train together, Bond being pursued by the twin - Bond kills the man and now finds himself lagging behind the train. He hitches a ride with a German couple, then steals a woman's car and drives to the airbase at Feldstadt with the local police in pursuit.
Bond forces his way onto the base, chased by security guards. Bond trades the twin's clothing for a clown suit and goes in search of the cannon. Bond immediately runs to the base commander, who is sitting with Octopussy at the performance. Khan and Gobinda have already stolen out of the tent to clear the blast area, leaving Octopussy behind. Bond tells the commander that the bomb is about to go off and pleads with Octopussy to back him up, showing her some of the fake jewelry. Failing that, Bond returns to the cannon to open the box and disarm the bomb. Though Bond is restrained by security, Octopussy now convinced, uses a guard's gun to disable the lock on the box which exposes the bomb With the bomb now exposed, the base commander gives Bond time to disarm the bomb, which he does. Bond removes the detonator just seconds before it activates, and the bomb is disarmed. Octopussy asks Magda where Khan went, she tells her back to India.
Both Bond and Octopussy separately follow Khan to his palace in Delhi. Octopussy uses her women followers as commandos to infiltrate the palace and subdue Khan's men. Octopussy finds Khan herself but is captured. Khan retreats to a waiting plane and takes off. Bond manages to grab hold of the plane's exterior and refuses to be thrown off by Khan. Khan sends Gobinda out to deal with Bond but Bond is able to throw him off the craft to his death. Bond next disables the tail mechanisms, sending the plan plummeting towards earth. Bond is able to find Octopussy inside the plane and the two jump to safety just before the plane crashes into a cliff, killing Khan.
Back in London, M meets with Gogol, who wishes to congratulate Bond personally for stopping Orlov. M says that Bond is still in India, recovering from varying injuries. In truth, Bond is fine and spends a romantic evening with Octopussy aboard her yacht.