Critics on both sides of the pond are hailing Teju Cole's novel Open City as a startling, sparkling and original debut. They are only half right. It is a strikingly original work, shimmering with its author's luminous intelligence. But it is not his debut.

That honour belongs to Every Day is for the Thief, a novella about a young Nigerian man's return home to Lagos from New York. It appears to have escaped the attention of critics because it was published in 2007 by Cassava Republic, a small Nigerian company. Arguably the best book about contemporary Lagos published in the past decade, Every Day is for the Thief received enthusiastic reviews on its publication in Nigeria. "This," said cultural critic Molara Wood, "is how to write about Africa."

A tiny gem of a book, it is filled with acute and clear-sighted observations about Lagos, a city from which stories emerge from every direction. "Had John Updike been African," muses the narrator, "he would have won the Nobel prize long ago. Shillington, Pennsylvania simply did not measure up to his extravagant gifts."

One can only imagine what Updike would have made of the Lagos of power cuts, traffic congestion, armed robbers and other hustlers, but Cole's gifts more than measure up to the task before him. He presents a Lagos of eccentricities and of joyousness as well as shocking levels of callousness. Through Cole's eyes, we experience Lagos as a city that is at once a product of its history and captive to its present, swerving between optimism and uncertainty.

That the Lagos of Every Day is for the Thief is a more hopeful place than the New York of Open City is testimony to Cole's refusal to write to stereotype. The unnamed narrator of the first book, who finds himself back in America again, responds actively to the city around him: he is in turns amused, indignant and horrified by what he sees. He is underwhelmed by the blithe description in the national museum of the slave trade as an "obnoxious practice" and dismayed by a display of Nigerian leaders that "celebrates the worst of the butchers that ran the nation aground".

Julius, the narrator of Open City, is just as sensitive to the New York whose pavements he plods, but he is essentially cut off from all around him. Every Day is for the Thief brims with energy; Open City pulls you into Julius's isolation, compelling you to share his loneliness.

Julius has reason enough to be unhappy. In the final year of his psychiatry residency at Columbia Presbyterian, he has been going through something of a rough patch. The space around him is filled with the absence of two women: his estranged German mother (his Nigerian father is dead) and his girlfriend, who has left him (and New York) for San Francisco. He is also desperate for something to help him "escape the regimen of perfection and competence" imposed by his work, which "neither allowed improvisation nor tolerated mistakes". He takes to walking up and down the streets of New York, his ceaseless strolls "a reminder of freedom".

There is a brief interlude in Brussels, but it is on New York's pavements that he walks. And while he walks, he thinks. And thinks. Cole draws us deeper and deeper into his mind, which has an astonishing depth of knowledge. Narrator and author range over subjects as varied as the slave trade, the music of Mahler, the paintings of John Brewster, Anthony de Hooges, an early Dutch settler, Belgian politics, the Liberian civil war, the Hungarian photographer Martin Munkácsi, bedbugs, killer bees and whales. Cole writes beautifully, weaving Julius's reflections seamlessly into his narrative. The hypnotic quality of Julius's introspection is sometimes interrupted by a level of detail that feels a little Wikipediac, such as when he reflects on a "fifty-four-foot sperm whale that beached itself in the sandy shallows of Berckhey, near The Hague" and took "four days to die and, in that time and in the weeks afterward, had entered into the legend of a nation at the very beginning of its modern history".

There are few jarring passages like this, mercifully, but when they do appear, they have the effect of inducing in the reader a strong desire to shake Julius for being an insufferable know-all. For the most part, he wears his erudition lightly, using it to illuminate aspects of New York that are relevant to his state of mind.

Cole is not only a fine writer, he is also a photographer and an art historian. He gives the reader a view of New York through the lens of a photographer, evoking the famous analogy Christopher Isherwood made of himself as a camera "with its shutter open, quite passive, recording". As Cole is an art connoisseur, it is apposite to compare his book with the old masters that he has studied. Like a Vermeer, a De Hooch or a Bruegel, which can be viewed many times and never fail to delight, Open City is a book that can be read again and again, with each reading bringing the reward of further insights.

Cole has said in interviews that he will turn his attention back to Lagos for his next book, a nonfiction account of the city. It cannot come too soon.