The first time we hear the hero speak, in this impressive, engrossing, deep and surprising novel, he says: 'I was away in my thoughts.' The curious phrase is echoed later by the mother of the novel's other main character, a 13-year-old girl: 'Her daughter was always off and away in her mind.' What it means to be 'away in your mind' is one of the key subjects here. Fantasy, day-dream, evasions, self-dramatisation, all the powerful and dangerous work of the imagination, do battle with the facts, things as they are. Can the imagined and the real ever be 'at one'?

The two main characters, Robbie Turner and Briony Tallis, are placed, in the first part of the novel, in an English setting of deceptive placidity. It is 1935, the summer of an intense heatwave and rumours of war. The Tallis family, inheritors of a 'baronial-Gothic' late-nineteenth-century mansion in Surrey with vestiges of a more elegant Adam-style house (a fountain, a temple) in the extensive grounds, aren't quite as solid as their house makes them look.

The father is away in London, involved in mysterious defence plans at the Ministry and a long-standing affair. The mother, Emily, is withdrawn into illness, and dogged by a life-long resentment of her self-pleasing sister, a promisingly reckless off-stage character called Hermione. The son is an affable joker; the older daughter, Cecilia, has been to Cambridge but is now at a loss; and her sister, Briony, is a ferociously orderly child 'possessed by a desire to have the world just so' - a desire that takes the form of writing. Handsome Robbie Turner is the family protégé: his mother is the charlady, and the Tallises have helped him get to Cambridge; he wants to be a doctor.

Into this household, one fatal day (as Briony might put it) come Hermione's neglected children: sexy, manipulative teenage Lola, and two pathetic twin brothers, whom Briony immediately ropes in to be in her play, a wonderful and absurd farrago called The Trials of Arabella. The play is meant to welcome home her brother, who arrives with a rich, stupid young businessman. By the end of the day, Robbie and Cecilia have discovered they are passionately in love, the twins have run away, Lola has been raped, Briony has accused Robbie of the assault and he has been arrested, and The Trials of Arabella has never been produced.

Part Two cuts to May 1940. Robbie has been let out of prison to join the infantry, and Cecilia is waiting for him to 'come back'. Both she and Briony (who are estranged) have gone into nursing. Two long sections describe, with unsparing, closely researched, gripping relentlessness, the retreat to Dunkirk, as experienced by Robbie and his two (splendidly done) comrades-at-arms and by Nurse Briony Tallis in St Thomas's Hospital. The bloody, chaotic shambles of the retreat sabotages one common national fantasy, of Dunkirk as a heroic rescue - a view of history consistent with all McEwan's previous work. Briony, matured by her hospital experience, goes to ask forgiveness of her sister.

In the last part of the novel, it's nearly 50 years on. Briony is a famous novelist in her seventies. She is suffering from the onset of dementia, which will produce complete memory loss (a terrible infliction, especially in a novel so much concerned with the power of memory). In a dazzlingly dexterous coda, she goes back to the family home, now a grand country-house hotel, for a reunion, where one last surprise awaits her - and us.

As in all McEwan's midlife work, a private drama of loss of innocence or betrayal is played out against a larger history of bad faith. Here, the personal story - especially Briony's childhood 'failure to grasp the simple truth that other people are as real as you', and her later struggle with remorse - is painfully strong. And there are all kinds of tender and exact human details: the lovers' determination to survive, the working-class mother's faith in her son, the confused funny hopelessness of the little boys, Emily's dedication to her migraines. But there is more going on here than a personal story.

Atonement, we at last discover, is the novel Briony Tallis has been writing between 1940 and 1999. This quite familiar fictional trick allows McEwan to ask some interesting questions about writing, in what is a highly literary book. The epigraph is a quotation from Northanger Abbey, where Catherine Morland is reproached by Henry Tilney for imagining Gothic horrors in a well-protected English setting. (In a nice echo, the Tallis-home-turned-hotel is called Tilney's.) All through, historical layers of English fiction are invoked - and rewritten. Jane Austen's decorums turn to black farce. Forster's novels of social misunderstanding - the attack on poor Leonard Bast, Adela Quested's false charge of rape - are ironically echoed.

When Briony starts writing Atonement as a novella, in 1940, she thinks it should be modern and impressionistic, like Virginia Woolf. But she gets a rejection letter from Cyril Connolly at Horizon telling her that fiction should have more plot. The advice comes from a friend of Connolly's, one Elizabeth Bowen. So her rewritten novella - the Part One of Atonement - recalls The Last September, with its restive teenage girl in the big house. Then Briony writes the war, and all the slow, deliberate literariness of Part One falls away.

Atonement asks what the English novel of the twenty-first century has inherited, and what it can do now. One of the things it can do, very subtly in McEwan's case, is to be androgynous. This is a novel written by a man acting the part of a woman writing a 'male' subject, and there's nothing to distinguish between them.

If fiction is a controlling play, a way of ordering the universe in which the writer is away in her - or his - thoughts, then is it a form of escapism, lacking all moral force? Is it just another form of false witness, and so always 'unforgivable'? And are some forms of fiction - modernist, middle-class, limited to personal relations - more unforgivable than others? A political critique edges in.

But I wasn't sure how much the life of establishment England (with its diplomats planning mass bombings, its rapacious businessmen, its repression of women, its maintaining of feudal class systems) was being held responsible for the carnage visited on the poor bloody infantry at Dunkirk. Robbie suggests it: 'A dead civilisation. First his own life ruined, then everybody else's.'

In Part One, there is a significant tussle between Cecilia and Robbie by the fountain, for a precious Meissen vase, given to an uncle in the First World War by the French villagers whom he had saved. The vase is broken, but mended so that the cracks hardly show (another literary bow, this time to The Golden Bowl). Just so, in Briony's accusation, 'the glazed surface of conviction was not without its blemishes and hairline cracks'.

In war-time, one of the servants breaks it irrecoverably. The 'making one' of the vase was a fix, and couldn't hold. Yet a great deal does survive at the end of the novel: family, children, memory, writing, perhaps even love and forgiveness. Or perhaps not; it depends which of the controlling novelist's endings we decide to believe in, as we hold this fragile shape of the unified fictional work in our mind's eye, and are made aware how easily it can all fall apart.