The Ghost is Roman Polanski's best film since Tess 30 years ago, and as immaculately crafted a thriller as we're likely to see this year. It may not be in the very first rank of his pictures, of which Chinatown remains the peak. But in every respect it's a characteristic work, with echoes of those stories of intruders breaking into troubled relationships (Knife in the Water,Cul-de-sac), savvy innocents getting out of their depth (Chinatown), people losing touch with their own identities (Repulsion, The Tenant), and the operation of a malevolent fate in a world where, like Oliver Twist, the trusting hero of Polanski's last film, you need to be suspicious of the kindness of strangers.

This is a wintry film, beginning with an intriguing image of an empty car left on the ferry between mainland Massachusetts and the vacation island of Martha's Vineyard as the other cars leave. It's a reference to The Testament of Dr Mabuse, the classic conspiracy thriller Fritz Lang made before leaving Germany in 1933. The car belonged, so we learn, to Mike McAra, a longtime aide to the former British prime minister Adam Lang, whose autobiography he'd been working on before vanishing from the ferry and being washed up in a nearby cove.

In an equally chilly London we then meet an unnamed writer (Ewan McGregor in impressive form), a classless figure with no particular convictions, moral or political, noted for ghosting celebrity autobiographies. At an emergency meeting he's hired on the spot to turn McAra's stodgy manuscript into a slick bestseller. When an old-fashioned English senior editor is brutally snubbed, it becomes clear that Lang is in the hands of a rich American publisher and a smart corporate lawyer, and that the Ghost is happy to be sold to them by his slick American agent for a quarter of a million dollars.

The scene shifts to the States, and everything thereafter is seen through the Ghost's eyes as he is sucked into a ruthless world of international power and intrigue. Martha's Vineyard in February is as bleak as Martin Scorsese's Shutter Island, and as much a prison. Adam Lang (Pierce Brosnan) and his wife, Ruth (Olivia Williams), live in his publisher's remote holiday home, an austerely elegant glass, concrete and slate affair, with a small staff headed by Adam's assistant, Amelia (Kim Cattrall), and secret service guards who act like warders. An edgy relationship is established between the residents and their ill-at-ease guest, as the popular hostility towards the ex-PM for joining the US in the war on terror turns nasty.

Lang's former foreign secretary accuses him of participation in the extraordinary rendition of four British subjects by the CIA. A warrant for his arrest is about to be issued by the International Criminal Court and, without realising the implications, the Ghost provides a statement of exculpation to be delivered to the press by Lang. "That makes you an accomplice," Amelia comments, which proves to be more than a wry joke.

From this point on, an efficient, logical and fast-moving thriller ensues, with suspense, twists and surprises, as the Ghost intuits that the death of his predecessor may not have been an accident or suicide. The discovery of a photograph and a mobile phone number brings him into contact with Adam's antagonists. A satnav in a hearse-like car used by McAra takes the Ghost on a journey to the mainland, where he's introduced to Lang's dubious academic associates (a striking cameo here from Tom Wilkinson). This sequence evokes Cary Grant's excursion to Long Island in North by Northwest, just as a later scene makes a link to Michelangelo Antonioni's Passenger. The crucial clue, however, is an old-fashioned form of literary encryption that brilliantly makes play of the nature of ghosting.

Harris prefaces his novel by quoting Evelyn Waugh's epigraph to Brideshead Revisited: "I am not I: thou art not he or she: they are not they." Obviously, the Langs are inspired by the Blairs but the film is not a Roman Polanski roman a clef. In a 1936 New Yorker cartoon by Peter Arno a group of rich Republicans passes some friends in a Manhattan street, saying: "Come along. We're going down to the Trans Lux [the city's celebrated newsreel cinema] to hiss Roosevelt." Anyone going to The Ghost to hiss at the Blairs would be disappointed. Adam as played by Brosnan has many of Blair's characteristics but is a figure in his own right, altogether sadder and more vulnerable. Williams, who is quite superb, gives Ruth a moral complexity and a sinister aspect that puts her in a different class from anything we might have inferred from the Cherie Blair on view in The Queen. On the other hand, the bearded Robert Pugh's former foreign secretary inevitably makes you think of Robin Cook.

Oddly, as co-adaptors, Polanski and Harris have played down a character carefully signalled in the book. In the film, the 94-year-old Eli Wallach plays an elderly Vineyard resident who gives the Ghost some vital information concerning the cove where McAra's corpse was washed up. In the novel, he is clearly identified as the former secretary of state Robert McNamara by his rimless glasses and hairstyle, his statement about war crimes ("We could all have been charged with those. Maybe we should have been") and a reference to a real event in 1972: "Hell, a guy tried to throw me off that damn ferry when I was still at the World Bank." This explains Harris's curious, ludic choice of the name McAra for the original ghost.