James Bond - agent 007 and sometimes referred to as simply '007' - and two other MI6 agents conduct a training exercise at a military base in Gibraltar with the SAS. There an assassin disguised as an MI6 agent gives a message to one of the agents (004), attaching a small note to a carabiner clip and sends it down the agents rope and then kills him by cutting his rappelling line, causing the agent to fall to his death. Bond witnesses the assassin trying to escape in a vehicle and pursues him, which results in the assassin's death.
Bond is sent to Bratislava to help Agent Saunders from Station V conduct the defection of a KGB officer, General Georgi Koskov, covering his intermission escape from a concert hall in Bratislava. During the mission, Bond notices that the KGB sniper assigned to prevent Koskov's escape is a female cellist from the orchestra. Noting the unsteady manner in which she is holding the rifle, Bond concludes that she is not a professional assassin. He shoots at her rifle, blowing out the breech, preventing her from shooting Koskov. Koskov is taken by car to an operating center of the Russian gas pipeline and is shot into Austria in a cleaning plug. Saunders is furious about Bond's decision to spare the cellist, but Bond defiantly says that he will risk M's displeasure.
In his post-defection debriefing, Koskov informs MI6 that the KGB's old policy of "Smiert Spionam", meaning "Death to Spies", has been revived by General Leonid Pushkin, the new head of the KGB. A blond assassin, Necros, infiltrates Koskov's safehouse disguised as a milkman, and abducts Koskov after a pitched battle. Bond is directed to track down Pushkin in Tangier and kill him in order to forestall further killings of agents and escalation of tensions between the Soviet Union and the West. Although Bond's prior knowledge of Pushkin initially leads him to doubt Koskov's claims, he agrees to carry out the mission when he learns that the assassin who killed 004 (as depicted in the pre-title sequence) left a note bearing the same message, "Smiert Spionam."
Bond's instincts about the cellist being an amateur are vindicated when Q runs her description through a database detailing all of the KGB's known female operatives, finding no match. Bond returns to Bratislava to track down the cellist, Kara Milovy. He discovers that Milovy is actually Koskov's girlfriend and begins to suspect that Koskov's entire defection was staged. Bond convinces Milovy that he is a friend of Koskov's and persuades her to accompany him to Vienna, supposedly to be reunited with him. Meanwhile, Pushkin meets with arms dealer Brad Whitaker in Tangier, informing him that the KGB is cancelling an arms deal previously arranged between Koskov and Whitaker. When Whitaker is meeting with Koskov and Necros, it is revealed that Koskov had faked his defection in order to manipulate the British to kill Pushkin in order to silence him since Necro's past with the KGB makes him unsuitable to perform this task himself as it would cause too much risk to their plans. After Koskov decides to have another British operative killed to further manipulate Bond, Whitaker agrees to it but wants Necros to kill Pushkin if Bond isn't able to in time before the end of the trade convention which Pushkin is in Tangier to attend.
During his brief tryst with Milovy in Vienna, Bond meets Saunders, who discovers a history of financial dealings between Koskov and Whitaker. As he leaves their meeting, Saunders is killed by Necros, who again leaves the message "Smiert Spionam."
Bond and Milovy promptly leave for Tangier, where Bond confronts Pushkin. Pushkin disavows any knowledge of "Smiert Spionam", and reveals that Koskov is evading arrest for embezzlement of government funds. During the trade convention, Bond fakes Pushkin's assassination (unknowingly saving Pushkin's life, as Necros infiltrated the trade conference to kill him) , inducing Whitaker and Koskov to progress with their scheme. While escaping with some girls, Bond soon finds that they are undercover CIA agents who take him to Felix Leiter and discovers that Felix has been investigating Whitaker illegal arms deals meaning they are both working on the same case. Meanwhile, Milovy contacts Koskov, who tells her that Bond is actually a KGB agent and convinces her to drug him so he can be captured.
Koskov, Necros, Milovy, and the captive Bond fly to a Soviet air base in Afghanistan, where Koskov betrays Milovy and imprisons her along with Bond. The pair escape and in doing so free a condemned prisoner, Kamran Shah, leader of the local Mujahideen tribe. Bond and Milovy discover that Koskov is using Soviet funds to buy a massive shipment of opium from the Mujahideen, intending to keep the profits with enough left over to supply the Soviets with their arms.
With the Mujahideen's help, Bond plants a bomb aboard the cargo plane carrying the opium, but is spotted and has no choice but to barricade himself in the plane. Milovy drives a jeep into the back of the plane as they take off, and Necros also leaps aboard at the last second. After a struggle, Bond throws Necros to his death and deactivates the bomb.
While they fly off, Bond sees Shah and his troops being pursued by the Soviet army. Bond flies over a large bridge that the Mujahideen have crossed and drops the bomb he'd deactivated, destroying the bridge and cutting off the pursuit of the Soviets.
Low on fuel and flying over Pakistan, Bond loses power to a few of the plane's engines and decides that they have to exit before crashing. He uses the jeep that Kara had driven into the back of the plane to escape. The plane crashes and explodes as he and Kara drive off toward Karachi.
Bond returns to Tangier and sneaks into Whitaker's home with Felix's help, where he finds Whitaker re-enacting the Battle of Gettysburg and playing out Pickett's Charge as he would have fought it. Whitaker is able to distract Bond long enough to arm himself with a few of his high-tech weapons. Bond eventually outwits Whitaker by planting an explosive charge on a heavy bust of a British general that crushes Whitaker. Pushkin enters, killing a guard that would have killed Bond and arrests Georgi Koskov, who tries to convince him that Whitaker had been holding him hostage.
Kara plays a concert in London where she's granted a solo performance. She's met by General Gogol who has accepted a diplomatic assignment in the West. He informs Kara that she'll be given a special passport that will allow her to leave and visit the Eastern Bloc whenever she likes. Bond is not at the event, however, having been re-assigned to a new mission.
Kara returns to her hotel room and finds Bond waiting for her. The two share a romantic kiss.