Richard Matheson's I Am Legend (1954) is a story of one man fighting against vampires in a post-apocalypse world. After a mysterious plague has killed or turned the rest of human race into zombie-like vampires (Romero's 1968 Night of the Living Dead being heavily influenced by this book), Robert Neville -- apparently the sole survivor after having lost his wife and little daughter -- has turned his home into a fortress against which vampires try to attack every night. During daytime, though, Neville runs around Los Angeles in his station wagon, picking up supplies from deserted stores and supermarkets, and hitting stakes to the hearts of vampires unconscious in their coma-like state.
This novel can be seen, like many other works in science fiction and horror of the same era, as another parable of the 1950s American Communist scare, but it's also a study of personal solitude and how one manages to cope with it and the changes it will bring about in one's psyche, physical and mental make-up. Like Robinson Crusoe on his island (to whom Neville actually compares himself at one point), Neville is a lonely man trying to survive in a hostile environment, his paranoia knowing no bounds but still being desperate for any contact, human or animal: his care and nurturing of a frightened stray dog at one of the novel's most emotional points being especially touching.
Following the model of Robinson, Neville also manages to maintain his sanity through various activities keeping him busy, such as working on wooden stakes in his workshop and growing garlic in his hothouse as protection against the vampires. Or at least most of his sanity: while he "medicates" himself with heavy drinking during those lonely evenings when listening to the threatening howls of vampires outside and becomes more paranoid and hermit-like all the time, he also systematically studies the physiological basis of this strange plague (not too much unlike AIDS), and like modern man of post-Enlightenment era, approaches vampirism scientifically rather than through the superstition of ancient legends and popular books like Bram Stoker's classic Dracula, which he merely dismisses as "soap opera"-like.
In the end Neville finds out that in the world where everyone else has turned into vampires, also "normality" is now defined in a new way: representing the "old breed" -- maybe predicting the widening generation gap becoming all the more obvious after the 1950s -- Neville is now an anachronism, a freak, the ultimate outsider, but also a feared and respected legend, as the title of the book indicates.
Film adaptations (which Matheson himself disliked, though both have now a certain cult following):
The Last Man On Earth (1964) trailer
More clips of The Last Man On Earth @ YouTube | The whole film @ archive.org
Omega Man (1971) trailer
More Omega Man clips @ YouTube
Latest news tell there's also a forthcoming film adaptation, starring Will Smith (remember I, Robot, another rendition of a classic science fiction tale?)... I guess it's just better to stick to the original book.