James McBride's The Good Lord Bird,” the comic and terrifying adventures of a disguised black child caught up in John Brown's abolitionist crusade, was the winner Wednesday night of the National Book Award for fiction.

George Packer's brutal examination of the modern class wars, “The Unwinding: An Inner History of the New America,” won for nonfiction during a dinner ceremony at Cipriani Wall Street in downtown Manhattan. Cynthia Kadohata's “The Thing About Luck” won for young people's literature and Mary Szybist's “Incardine” won for poetry.

McBride, the picture of style in a tux and pork pie hat, confided during his acceptance speech that in recent years his mother and niece had died and that his marriage had collapsed. He found consolation in his novel and its protagonist, a boy pretending to be a girl and nicknamed “Onion” by Brown, who recruited him for his ill-fated attempt to free the slaves.

“It was always nice to have somebody whose world I could just fall into and just follow him around,” said McBride, best known for his million-selling memoir “The Color of Water.”

Packer, a staff writer for The New Yorker, praised some of the workers who allowed him to tell their stories. He said that he hoped his book would “illuminate some of what's gone wrong in America” in recent years” but also “some of what's gone right.”

Kadohata, a winner in previous years of the prestigious Newbery award for children's books, was awarded Wednesday for her story of two children being cared for by their Japanese grandparents. Szybist, who won for her collection of religious-themed poems, said that writing itself was an act of faith and self-discovery.

“It's what some describe as soul-making,” she said.

Winners, chosen by five member panels of writers, booksellers and others from the publishing community, each received $10,000. Honorary medals were presented to Maya Angelou, introduced and praised by Toni Morrison as a balm against the “toxicity” of the world, and E.L. Doctorow, who acknowledged the allure of the Internet and warned against its dangers.

“Everyone in this room is in the free speech business,” he said, referring to the many reports of extensive government surveillance.