Now, pay attention, because this one's just for you. Having neatly anatomised the dilemmas of Arsenal fans, half-hearted boyfriends and anxious father figures, Nick Hornby has now trained his finely honed brand of ironic earnestness - or earnest irony - on the infinitely nuanced agonies of Guardian readers. When Dr Katie Carr, the compromised narrator of his third novel, feels particularly daunted by the trench warfare of domestic life, she retreats to bed with this newspaper, the better to distract her mind with the unhappiness of strangers. In a moment of anguished intellectual vandalism, she even rips out an especially sad story - refugees holed up in an east London church - not in order to consider it more deeply at a later date, but to prevent it from inspiring her do-gooding husband David to even greater heights of selflessness and charity.

As its title suggests, How to Be Good considers the problem of virtue and, as a GCSE question might frame it, Its Place in the Modern World. But despite such a universal theme, it is nothing if not culturally specific: the modern world has been deliberately shrunk to encompass Guardian -reading professionals in north London. Katie is a GP, and therefore unassailably good, while David is The Angriest Man In Holloway. So disillusioned and grumpy is he that he writes a local newspaper column on the subject, berating pensioners for not having their change ready when they board buses and lambasting contemporary theatre. He and Katie loathe one another, but are prevented from separation by Tom and Molly, their two children, and by what one might call habitual codependency. At the start of the novel, Katie, emboldened by a lacklustre affair, brandishes divorce in a reckless, momentary attraction to Mutually Assured Destruction; by its end, she has been forced to contemplate the implications of her desire to be free of what she imagines constrains her.

We proceed from A to B via a rather startling reductio ad absurdum. Having fervently wished for a different husband, Katie gets one, with Hornby invoking the old chestnut that tells us to be careful what we wish for. David's aching back is miraculously cured by a Finsbury Park faith healer called GoodNews, and thereafter his soul also undergoes a complete transformation. Deciding that a life of bile is not for him, he becomes very good, very quickly. Within a matter of hours he is busy giving away the family's possessions, donating their food to the local vagrants and persuading the wary neighbours to give shelter to homeless teenagers. To make Katie's misery complete, GoodNews, the offspring of a vague union between Swampy and Raj Persaud, moves in and sets about persuading the family that beds and dishwashers are not only unnecessary, but bordering on outright evil.

Hornby has previously made great comic capital out of his own and his characters' bemusement at the unexpected complexity of the world. He once, after all, spent an entire newspaper column shaking his head over the fact that there were nice people out there who hadn't become his friends because, unfortunately, he hadn't met them. He is rueful, polite, mildly disappointed, and afflicted by a low-key melancholy. By his standards, one might think, the problem of good and evil ranks as a philosophical debate to be filtered through questions of etiquette such as whether one should really eat veal (according to Katie, it's OK if you've spent your day ministering to the sick) or how much one can decently give someone on the street if one desperately wants to get a taxi home.

But in How to Be Good , a novel besieged by flaws of its creator's making (rank unbelievability and exhausting equivocation, to name a couple) but nonetheless enormously readable and ultimately powerful, Hornby ups the ante. It's as if, in Katie's stupendously naive moral reckonings - the veal is just one example of how she flashes her stethoscope at any hint of imperfection - the author is chastising himself for allowing light observational humour to obscure his deeper purpose. Like David, challenging Katie on why indeed they shouldn't permanently house one of her "heartsink" patients, Hornby is defying us to ridicule his outrageously jerry-built plot, the uncomfortable logical ends of his grand assertions and unanswerable conclusions.

While the novel hops from one farcical set piece to another - David and GoodNews hosting a cringingly embarrassing neighbourhood party, Katie grimacing through a church service in which a middle-aged vicar raps her sermon - its author is dashing round the back, frantically stopping up the exit routes. Deft comic riffs bring us send-ups of Walking with Dinosaurs , Geri Halliwell, awkward children and marital showdowns over roast chicken, but this is Hornby on autopilot. His real energies are devoted to Katie's middle-of-the-night soliloquies, the fretful soul-searching that revolves around a series of intractable posers. Should she stay or should she go? Is she good or is she bad? Does she want any thing to change?

It is Hornby who poses the questions, but if he has the answers, he doesn't want to give them to us. Instead, he has Katie slowly reveal herself as a person of limited imagination, a self-stereotyper who has done a fine job of boxing herself in. From the outset, she confides that her conception of her life has been couched largely in fantasies: of what it would be like to be a doctor, or married, or the mother of two children, or amicably divorced, or happily single and unencumbered. This makes her seem a bit dim, but not particularly unusual. GoodNews diagnoses a lack of feeling, a flat battery; and to somebody who has staked their claim to moral salvation on an excess of empathy, this is a body blow.

The disintegration of Katie's amour propre is the engine that drives the novel, and focuses our attention away from the plot's larger distractions - the crisis of liberalism, for example, in the face of inflated house prices and the rise of gastro-pubs - and towards its more subtle theme. David, albeit courtesy of a possible charlatan, experiences the instantaneous gift of authenticity, and thereby a tentative salvation. Katie and her flat battery must grope towards such redemption slowly, hampered by irrepressible failings such as disliking her children and wanting to show GoodNews the door. If Hornby's final contribution to this painful process is unconvincing - Katie reckons she might just be able to cope if she gets the odd trip to Waterstone's and a Discman of her own - then it's probably because he doesn't altogether believe it himself.

How to Be Good creaks in all sorts of ways, but at the end, it does hold together. It is hard to dislike a writer who seems more perplexed than his readers, and is willing to share that sense of confusion and dismay. The earnestness, the drive towards overexplication in order to show that it's not just a gag, he's really thought about it properly, his faux-naivety that might be real - all of this is, luckily, for him, both charming and affecting. The result is a novel that hopes to embarrass its readers into taking it seriously, a risky strategy that succeeds, just about, more often than it fails. Hornby has often been praised for his generosity and his gentleness, and those attributes underwrite every line of this saddening, maddening novel, but he also shows us a somewhat more punitive, less forgiving side. He should bare his teeth more often.