The Spy Who Loved Me is the ninth novel and tenth book in Ian Fleming's James Bond series, first published by Jonathan Cape on 16 April 1962. It is the shortest and most sexually explicit of Fleming's novels, as well as the only Bond novel told in the first person. Its narrator is a young Canadian woman, Viv Michel. Bond himself does not appear until two-thirds of the way through the book, arriving at precisely the right moment to save Viv from being raped and murdered by two criminals. Fleming wrote a prologue to the novel giving the character Viv credit as a co-author.

The story uses a recurring motif of Saint George against the dragon, and contains themes of power, and the moral ambiguity between those acting with good and evil intent. As the narrator who tells her own backstory and expresses her emotions and motives, Viv has been described as the best realised and most rounded female character in the Bond canon. The reviewers were largely negative, with some expressing a desire for a return to the structure and form of the previous Bond novels. In a letter to his editor after the reviews had been published, Fleming reflected that "the experiment has obviously gone very much awry".

Following the negative reactions of critics, Fleming attempted to suppress elements of the novel: he blocked a paperback edition in the United Kingdom and, when he sold the film rights to Harry Saltzman and Albert R. Broccoli, they were permitted to use the title but none of the plot of the book. In the 1977 film The Spy Who Loved Me, the tenth in the Eon Productions series, only the title and the character of one of the villains, Jaws, are taken from the book. The film was the third to star Roger Moore as Bond. A heavily adapted version of The Spy Who Loved Me appeared in The Daily Express newspaper in daily comic strip format between 1967 and 1968; a British paperback edition of the novel was published after Fleming's death.

Plot summary Fleming structured the novel in three sections—"Me", "Them" and "Him"—to describe the phases of the story. In the prologue he described the origin of the manuscript:

I found what follows lying on my desk one morning. As you will see, it appears to be the first-person story of a young woman, evidently beautiful and not unskilled in the arts of love. According to her story, she appears to have been involved, both perilously and romantically, with the same James Bond whose secret service exploits I myself have written from time to time. With the manuscript was a note signed "Vivienne Michel" assuring me that what she had written was "purest truth and from the depths of her heart". I was interested in this view of James Bond, through the wrong end of the telescope so to speak, and after obtaining clearance for certain minor infringements of the Official Secrets Act I have much pleasure in sponsoring its publication.

Me Vivienne "Viv" Michel, a young Canadian woman, narrates her own story, detailing her past love affairs. The first was with Derek Mallaby: the couple had sex in a field after being thrown out of a cinema in Windsor for indecent exposure. Their physical relationship ended that night, and Viv was subsequently rejected when Mallaby sent her a letter from Oxford University, where he was studying, saying he was forcibly engaged to someone else by his parents. Viv's second love affair was with her German employer, Kurt Rainer, by whom she eventually became pregnant. She informed Rainer and he paid for her to go to Switzerland to have an abortion, telling her that their affair was over. After the procedure, Viv returned to her native Canada and started on a journey through North America. She stopped in the Adirondack Mountains to work at the Dreamy Pines motel, in the employ of the managers Jed and Mildred Phancey.

Them At the end of the vacation season, the Phanceys entrust Viv with looking after the motel for the night before the owner, Mr Sanguinetti, can arrive to take inventory and close it up for the winter. Two mobsters, "Sluggsy" Morant and the steel-toothed Sol "Horror" Horowitz, both of whom work for Sanguinetti, arrive and say they are there to look over the motel for insurance purposes. The two have been hired by Sanguinetti to burn down the motel so that he can make a fraudulent insurance claim. The blame for the fire would fall on Viv, who was to perish in the incident. The men immediately start harassing Viv, making crude passes and aggressively asking her to dance; when she says she does not want to, they attack her, intending to rape her, when the door buzzer interrupts them.

Him The British secret service agent James Bond appears at the door asking for a room, having had a flat tyre while passing. Bond soon realises that Horror and Sluggsy are mobsters and that Viv is in danger. Bond pressures the gangsters into providing him a room. Bond tells Viv that he is in America in the wake of Operation Thunderball and had been detailed to protect a Russian nuclear expert who defected to the West. That night Sluggsy and Horror set fire to the motel and attempt to kill Bond and Viv. A gun battle ensues and, during their escape, Horror and Sluggsy's car crashes into a lake. Bond and Viv retire to bed, but Sluggsy is still alive and makes a further attempt to kill them, before Bond shoots and kills him.

Viv wakes to find Bond gone, leaving a note in which he promises to send her police assistance and which he concludes by telling her not to dwell too much on the ugly events through which she has just lived. As Viv finishes reading the note, a large police detachment arrives. After taking her statement, the officer in charge of the detail reiterates Bond's advice, but also warns Viv that all men involved in violent crime and espionage, regardless of which side they are on—including Bond himself—are dangerous and that she should avoid them. Viv reflects on this as she drives off at the end of the book, continuing her tour of America; despite the officer's warning, she still devotes her thoughts to Bond.

Background and writing history By January 1961 the author Ian Fleming had published eight books in the preceding eight years: seven novels and a collection of short stories. A ninth book, Thunderball, was being edited and prepared for production; it was released at the end of March 1961. Fleming travelled to his Goldeneye estate in Jamaica in January to write The Spy Who Loved Me. He followed his usual practice, which he later outlined in Books and Bookmen magazine: "I write for about three hours in the morning ... and I do another hour's work between six and seven in the evening. I never correct anything and I never go back to see what I have written ... By following my formula, you write 2,000 words a day." He found writing The Spy Who Loved Me easier than any of his other books.

Fleming returned to London in March that year with a 113-page typescript, the shortest of any of the Bond books. Few alterations were made to the story before publication. After the book was published he wrote to Michael Howard, his editor at Jonathan Cape, to explain why he had changed his approach:

I had become increasingly surprised to find that my thrillers, which were designed for an adult audience, were being read in schools, and that young people were making a hero out of James Bond ... So it crossed my mind to write a cautionary tale about Bond, to put the record straight in the minds particularly of younger readers. It was impossible to do this in my usual narrative style and I therefore invented the fiction of a heroine through whom I could examine Bond from the other end of the gun barrel, so to speak. This I did by telling the story in her own words of her upbringing and love life, which consisted of two incidents, both of which were of a strongly cautionary nature.

Fleming found writing the Bond novels increasingly arduous and had thoughts of finishing the series by killing Bond in The Spy Who Loved Me, but changed his mind while writing. The novel is described by Fleming's biographer Andrew Lycett as Fleming's "most sleazy and violent story ever". This, writes Lycett, may have been a reflection of Fleming's state of mind at the time, particularly his ongoing marital difficulties: he was having an affair with his neighbour in Jamaica, Blanche Blackwell, and his wife Ann was in a relationship with Hugh Gaitskell, the Leader of the British Labour Party. Fleming also had a strained professional relationship with the writer and director, Kevin McClory, with whom he was working on a film treatment which eventually Fleming published as the novel Thunderball.

Although Fleming did not date the events within his novels, John Griswold and Henry Chancellor—both of whom wrote books for Ian Fleming Publications—identified different timelines based on events and situations within the novel series as a whole. Chancellor put the events of The Spy Who Loved Me in 1960; Griswold considers the story to have taken place in October 1961.

Development Plot inspirations For The Spy Who Loved Me, Fleming borrowed from his surroundings and experiences, as he had done with all his writing up to that point. The Dreamy Pines Motel in the Adirondacks was based on one Fleming would drive past on the way to a friend's Black Hole Hollow Farm in Vermont; Viv is seduced by Derek, a public school boy, in the Royalty Kinema, Windsor, in the same way Fleming—while at the nearby public school Eton—seduced a woman and lost his virginity in the same establishment. Her time with Derek in the area around Cookham, Berkshire, is similar to Fleming's activities and experiences while he was at the Royal Military College, Sandhurst.

As he had done in his previous novels, Fleming borrowed names from his friends and associates to use in his book: Robert Harling, a colleague at The Sunday Times, gave his name to a printer in the story while another minor character, Frank Donaldson, was named after Jack Donaldson, a friend of Ann Fleming. One of Fleming's neighbours in Jamaica was Vivienne Stuart, whose first name Fleming used for the novel's central character.

Characters The novelist Raymond Benson—who later wrote a series of Bond novels—sees Vivienne Michel as the best-realised female characterisation undertaken by Fleming, partly because the story is told in the first-person narrative with the first third of the novel dedicated to her biography. Benson notes that while Viv has been a victim of life in the past, she is wilful and tough too. Viv is not a fashionable stylish woman of the 1950s, but one who likes camping, fishing and other outdoor activities; Chancellor states that in this respect, she is, like Bond, an ideal from Fleming's imagination.

The academic Christine Bold considers that Viv demonstrates a naïve view of life, and that the character reinforces Fleming's misogynistic view of women as they had been portrayed in the earlier Bond stories. Bold sees that Viv "underwrites Bond's sexual dominance over women" by having sex with him after he saves her. It is at this point in the novel that Fleming (as Viv) writes "All women love semi-rape. They love to be taken." The claim was one for which Fleming was criticised. The opinion of the journalist Ben Macintyre is that "Fleming was not seriously defending rape, or even semi-rape, but trying to shock by reinforcing the idea of Bond's essential cruelty. If so, he shocked far more than he intended, and he still does". Despite her rescue from near-rape and death, the author Nick Stone thinks that:

... at the end there is very little resolution for Vivienne, and next to no catharsis. The reader is left with the sense that she will only add the scars of her 'night of screaming terror' at the hands of the villains to those inflicted from her past.