One of the many good things about Iain Banks is that there was a lot of him, as a writer, to go around. Over the course of his 28 novels, he catered for a wide range of tastes. His output was split between science fiction and "mainstream" – he seems to have turned to literary fiction in disappointment after his early SF novels were rejected. But even within the mainstream works, there was a great deal of variation.

He is still associated by many with the transgressive, black comic Scots macabre of his 1984 debut The Wasp Factory; a tendency that reached its splattery high-water mark with the political revenge fantasy Complicity, which tortured, raped and gleefully snuffed out various figures representing the ills of modern Britain.

But Banks also wrote genre-bending postmodern works, such as The Bridge, a Kafkaesque allegory which he regarded as his best novel ("Definitely the intellectual of the family," he said. "It's the one that went away to university and got a first").

My own preference is for his broadly realistic coming-of-age stories, the family sagas – such as last year's Stonemouth, The Steep Approach to Garbadale, and most of all, 1992's The Crow Road. These tend to be set in a closely observed present-day Scotland, and to feature a freewheeling, eventful plot with comic and gothic elements.

There's usually a big house, a homecoming, and at least one terrible family secret. Banks's final novel, published only days after his death, bears a family resemblance to these, though it's shorter, simpler, and takes place in north-east England. Fans of The Wasp Factory will notice echoes of that novel in The Quarry; both feature a strange teenage narrator kept in an isolated house by a deceitful father figure. The mood, however, is very different; though there's plenty of rage and gallows humour, a plot that the earlier Banks might have made into a psychosexual horror story is taken in a gentler direction.

Kit is an 18-year-old who is somewhere on "a spectrum that stretches from 'highly gifted' at one end to 'nutter' at the other"; the words "obsessive compulsive behaviour" and "Asperger's" are bandied about. He lives alone with his father, Guy, in a large, ramshackle country house not far from Newcastle.

Though Banks wrote most of the novel before his diagnosis early this year, it is dominated by a sense of mortality and loss – and by cancer. Guy has terminal lung cancer, while the stone quarry of the title is expanding slowly towards the house, which will soon be demolished. There is much clearing-out of closets, and burning of old possessions.

The action takes place over a weekend-long reunion. Guy invites his old friends from his media studies course, who all lived together in his house: Hol, a fierce film critic who is nevertheless Kit's only real friend; Rob and Alison, who talk in corporate cliches and work in "moral compliance" for an internet behemoth; Haze, a drug-addled sponger; Pris, a dazed single mother; and Paul, a tough lawyer and prospective New Labour MP. "Just like the old days, except with me dying," remarks Guy. The characters are all, apart from Hol, pretty foul – and needlessly unpleasant to the soon-to-be orphaned Kit. They get drunk, take drugs, bicker and needle each other. As Guy puts it, there is "hot and cold running sarcasm in every fucking room" .

The action is punctuated by a series of distinctively Banksian rants on subjects such as the failures of British politics, the horrors of recent American foreign policy, the idiocy of alternative medicine, and the absurdity of believing in God. Guy delivers a long, sweary farewell message ("I shall … consider myself well rid of this island's pathetic, grovelling population of celebrity-obsessed, superficiality-fixated wankers," it begins.) Meanwhile, there are two MacGuffins to drive the plot forward: Kit is trying to discover the identity of his mother, which Guy has concealed; and all the characters are anxiously looking for a tape – which may or may not be a porn film that they made in their student days.

Banks seems to have thought of The Quarry as a relatively minor piece, and he's probably right. He wrote fast, usually producing his novels over no more than three or four months. Perhaps as a result, they do sometimes seem rushed, and some of the characters and situations here are a little sketchy. The other side of the coin is Banks's relaxed fluency – the direct, funny, unpretentious intelligence of his writing, which, along with his teeming imagination, made him perhaps Britain's best-loved major contemporary novelist.

But this is an honest, low-key evocation of the void opening up beneath a life, filled with memorable lines: "That's the thing about cancer; it's all yours – it's entirely, perfectly personalised … a kind of unwilled suicide, where … one small part of the body has taken a decision that will lead to the death of the rest." The Quarry is an honourable finale to an exciting career.

• Read an extract from The Quarry