The writer Iain Banks, who has died aged 59, had already prepared his many admirers for his death. On 3 April he announced on his website that he had inoperable gall bladder cancer, giving him, at most, a year to live. The announcement was typically candid and rueful. It was also characteristic in another way: Banks had a large web-attentive readership who liked to follow his latest reflections as well as his writings. Particularly in his later years, he frequently projected his thoughts via the internet. There can have been few novelists of recent years who were more aware of what their readers thought of their books; there is a frequent sense in his novels of an author teasing, testing and replying to a readership with which he was pretty familiar.

His first published novel, The Wasp Factory, appeared in 1984, when he was 30 years old, though it had been rejected by six publishers before being accepted by Macmillan. It was an immediate succès de scandale. The narrator is the 16-year-old Frank Cauldhame, who lives with his taciturn father in an isolated house on the north-east coast of Scotland. Frank lives in a world of private rituals, some of which involve torturing animals, and has committed several murders. The explanation of his isolation and his obsessiveness is shockingly revealed in one of the culminating plot twists for which Banks was to become renowned.

It was followed by Walking on Glass (1985), composed of three separate narratives whose connections are deliberately made obscure until near the end of the novel. One of these seems to be a science fiction narrative and points the way to Banks's strong interest in this genre. Equally, multiple narration would continue to feature in his work.

The next year's novel, The Bridge, featured three separate stories told in different styles: one a realist narrative about Alex, a manager in an engineering company, who crashes his car on the Forth road bridge; another the story of John Orr, an amnesiac living on a city-sized version of the bridge; and a third, the first-person narrative of the Barbarian, retelling myths and legends in colloquial Scots. In combining fantasy and allegory with minutely located naturalistic narrative, it was clearly influenced by Alasdair Gray's Lanark (1981). It remained the author's own avowed favourite.

His first science fiction novel, Consider Phlebas, was published in 1987, though he had drafted it soon after completing The Wasp Factory. In it he created The Culture, a galaxy-hopping society run by powerful but benevolent machines and possessed of what its inventor called "well-armed liberal niceness". It would feature in most of his subsequent sci-fi novels. Its enemies are the Idirans, a religious, humanoid race who resent the benign powers of the Culture. In this conflict, good and ill are not simply apportioned. Banks provided a heady mix of, on the one hand, action and intrigue on a cosmic scale (his books were often called "space operas"), and, on the other, ruminations on the clash of ideas and ideologies.

For the rest of his career literary novels would alternate with works of science fiction, the latter appearing under the name "Iain M Banks" (the "M" standing for Menzies). Banks sometimes spoke of his science fiction books as a writerly vacation from the demands of literary fiction, where he could "pull out the stops", as he himself put it. Player of Games (1988) was followed by Use of Weapons (1990). The science fiction employed some of the narrative trickery that characterised his literary fiction: Use of Weapons, for instance, featured two interleaved narratives, one of which moved forward in time and the other backwards. Their connectedness only became clear with a final, somewhat outrageous, twist of the narrative. His many fans came to relish these tricks.

In 1991 Banks moved from England to Scotland, settling in North Queensferry, Fife, very close to his childhood home. He had remained close to his parents, who in their old age moved to live next to him.

Scottish settings now became important to many of his novels. The Crow Road (1992) is a Scottish family saga, though its traditional form is disguised by narrative time shifts and witty references to popular culture. Banks's abiding love of cars is encoded in the book, many of whose key events – including birth, copulation and death – occur in cars. The protagonist loses his virginity on the back seat of a Lagonda Rapide Saloon. In 2006, finally conceding to the force of green politics, Banks sold his two Porsches, his BMW and his Land Rover in favour of a Lexus hybrid.

The Crow Road, with its cast of eccentrics and its exactly observed local detail, was successfully serialised for BBC television in 1996 by the screenwriter Bryan Elsley. The production was directed by Gavin Millar, who several years later also directed a TV version of Banks's next novel, Complicity (1993). This was a less buoyant and formally more restive work. Its protagonist, a Scottish journalist called Colley, finds himself implicated in the crimes of a serial killer. The novel alternates the narration of the journalist, written in the first person, with the narrative of the murderer, told in the second person.

By the time that Banks was duly named as one of Granta's Best Young British Novelists in 1993 (aged then 39) he was an established name with a strong and often youthful following.

In 1997 he produced A Song of Stone, a bleak political fable set in some unnamed land where civilisation has collapsed. Always a man of the left, Banks was animated by political causes and his pronouncements began to attract journalistic attention. The Iraq war made him a loud critic of Tony Blair. The impress of his political views was increasingly evident in his fiction and it seemed to some of his admirers that they were exerting too strong an influence. Dead Air (2002), featured a narrator, Ken Nott, whose views seem little distanced from his author's and who is licensed to berate the reader about political morality, American imperialism, the Royal family and the like.

Banks's next work of literary fiction was The Steep Approach to Garbadale (2007), a return to the territory of The Crow Road. Banks's protagonist, Alban McGill, struggles to prevent his family's company from being taken over by a US giant, occasioning diatribes against American capitalism and American foreign policy that seem straightforwardly authorial.

His science fiction works, meanwhile, seemed liberated from some of his grimmer certainties and were notably even-handed in their treatment of moral and ideological dispute. From Excession (1996) to The Hydrogen Sonata (2012), he produced a sequence of seven science-fiction novels, all but one of which, The Algebraist (2004), belonged to the Culture series. Agents of The Culture are on a mission to spread democracy, secularism and social justice throughout the universe. It might be thought that they represent Banks's own values. Yet, as a novelist, he had considerable sympathy for those who resist this imposition of contentment.

Banks was born in Dunfermline, the only child of an admiralty officer and a former professional ice skater. As a boy, following his father's postings, he lived first in North Queensferry and later in Gourock, Inverclyde. He was educated at Gourock and Greenock high schools before attending the University of Stirling, where he read English, philosophy and psychology. (He would later teach creative writing at the university, which awarded him an honorary doctorate in 1997.)

After graduating in 1975 he took a series of jobs, including working as technician at the Nigg Bay oil platform construction site and at the IBM computer plant at Greenock. He visited the US and then moved to London, where he worked as a clerk in a Chancery Lane law firm. Here he met his partner, later to become his first wife, Annie.

While he worked he was writing. In the late 1970s he completed three science fiction novels that failed to find publishers, though all three would later be reworked and published successfully. Then followed one of the more remarkable literary debuts.

In 2010 Banks publicly joined the cultural boycott of Israel, refusing to allow his novels to be sold in the country. He was a frequent signatory of letters of protest to the Guardian and a name recruited to causes of which he approved, from secular humanism to the legalising of assisted suicide to the preservation of public libraries. Banks himself was a self-declared "evangelical atheist" and a man of decided political views, often expressed with humorous exasperation and sometimes requiring ripe language. He relished his public status as no-nonsense voice of a common-sense socialism that had an increasingly nationalistic tint.

An expert on Scottish whisky (when he won TV's Celebrity Mastermind, his specialist subject was Scottish whiskies and distilleries), Banks enjoyed the conviviality of a shared drink. In 2003 he published Raw Spirit: In Search of the Perfect Dram, an account of his travels through the highlands and islands of Scotland in pursuit of the history and the special pleasures of malt whisky. He confessed to over-indulgence in this pleasure at some stages of his life, and to the recreational use of drugs. It was characteristic of him to state the fact in interviews with journalists.

In 2010 he gave an interview to BBC Radio Scotland in which he spoke with painful frankness about the breakdown of his relationship with his first wife. But then the media interview seemed his natural forum: it is difficult to think of a more frequently interviewed British novelist.

While his science fiction spanned inter-stellar spaces, his literary fiction kept its highly specific sense of place. The place that gives the title to his 2012 novel Stonemouth is fictional, but, like other fictional places in earlier Banks novels, it is a highly specific Scottish town. Like The Crow Road and The Steep Approach to Garbadale –it is the story of a man coming back to his family home, and it is difficult not to think that this is Banks's story of himself.

It even opens, like The Bridge, with an evocation of the Forth road bridge, the building of which Banks had watched as a boy from his bedroom window – or at least in this case, of a fictional bridge resembling it. For all their formal inventiveness and play of ideas, his novels remain memorable for the sense they give of their author's personal memories and passions.

His announcement of his terminal illness provoked an outpouring of dismay and affection from his readers – not least on this newspaper's website. It was striking how many of those who responded to the news spoke of having encountered him in person, often after a reading or public interview. A significant number recalled sharing not just a conversation but also a drink with him: he was an author whose readers felt in close touch with him. He clearly relished this closeness, regarding the round of literary festivals and speaking engagements, often a chore for contemporary authors, with undisguised pleasure.

Shortly after the announcement, Banks married his partner, Adele Hartley, and she survives him.

• Iain Banks, writer, born 16 February 1954; died 9 June 2013

• This article was amended on 10 June 2013. The novel Stonemouth does not open on the Forth road bridge, but on a fictional bridge resembling it. This has been corrected.

