The Sri Lankan writer’s novel is about a photographer who wakes up dead, with a week to ask his friends to find his photos and expose the brutality of war.
Camilla, the Queen Consort, presented the prize, and the author said it had been “an honour and a privilege” to be on the shortlist.
Pop singer Dua Lipa was the star guest.
The other five authors on the shortlist receive £2,500 apiece as part of the renowned £50,000 prize for a single English-language novel published in the UK.
The writer said he decided in 2009 to write “a ghost story where the dead could offer their perspective” after the end of the Sri Lankan civil war, “when there was a raging debate over how many civilians died and whose fault it was”.
Head judge Neil MacGregor praised the “scope and the skill, the daring, the audacity and hilarity” of the novel, calling it an “afterlife noir” which “takes the reader on a rollercoaster journey through life and death”.
He said the judges’ decision had been unanimous, adding all of the shortlisted books were “all really about one question, and that is what’s the point of an individual life?”
Karunatilaka said as he accepted his prize: “My hope is that in the not too distant future… Sri Lanka has understood that these ideas of corruption and race-baiting and cronyism have not worked and will never work.
‘I have self-censored’
“I hope it’s in print in 10 years… if it is, I hope it’s written in a Sri Lanka that learns from its stories, and that Seven Moons will be in the fantasy section of the bookshop, next to the dragons, the unicorns and will not be mistaken for realism or political satire.”
He later added that he had “self-censored” a couple of short stories after author Salman Rushdie was stabbed in August, having faced years of death threats for his novel The Satanic Verses, which some Muslims see as blasphemous.
“I was in the process of publishing a collection of short stories when this incident happened, and I discovered a couple which I don’t think was offensive to any religion,” Karunatilaka said.
“But my wife said, can you not do that? You’ve got two young kids. This story is not that good. Just leave it out.”
He added that “this is something that hangs over all of us if we’re writing in South Asia, especially writing about politics or religion”.