Josef Skvorecky, a Czech writer whose novel “The Engineer of Human Souls” is considered a classic account of the absurdity of life in a totalitarian state, died Jan. 3 at a hospital in Toronto, where he had lived for more than 40 years. He was 87.

His Canadian publisher and longtime friend, Louise Dennys, said he had cancer.

In addition to writing many books, Mr. Skvorecky (pronounced shook-vor-ETZ-kee) played a significant part in publishing the works of other Czech dissident writers.

He and his wife, Zdena Salivarova, were the first publishers of Milan Kundera’s “The Unbearable Lightness of Being” as well as works by Bohumil Hrabal, Ivan Klima, Ludvik Vaculik and Vaclav Havel. (Havel, who later became the Czech president, died Dec. 18.)

Mr. Skvorecky arranged for the books to be smuggled into Communist-controlled Czechoslovakia, where they were widely copied and passed from hand to hand as “samizdat,” or clandestine literature. (The country split into the Czech Republic and Slovakia in 1993.)

Mr. Skvorecky’s own books were circulated in the same manner. He often ran afoul of the country’s Communist authorities, and before leaving Czechoslovakia in 1969 he had lost jobs and had many of his works banned. But the sanctioned disapproval only made him more esteemed in the eyes of the Czech public.

“If you live in a country where politics are oppressive and you write,” Mr. Skvorecky said in a 1985 interview with the Paris Review, “you can’t avoid being a political writer.”

The first of his novels to gain recognition, “The Cowards,” came out in 1958, 10 years after it was written. The book’s satiric depiction of the Communist takeover of Czechoslovakia in the late 1940s prompted an instant backlash from the authorities, who sought to remove it from bookstore shelves.

It was also considered a literary breakthrough for its casual style, complete with street slang inspired by Mr. Skvorecky’s study of Ernest Hemingway and American detective fiction. The novel’s protagonist, Danny Smiricky, became a much-loved character who reappeared in many of Mr. Skvorecky’s later books.

The jazz-loving Danny, hapless but ever hopeful in love, was clearly Mr. Skvorecky’s alter ego. Both were would-be saxophonists who nurtured a lifelong fascination with American writers and culture.

Danny was the central character of “The Engineer of Human Souls,” which Mr. Skvorecky published in Czech in 1977 and in English in 1984. (The book’s title came from a term used by Soviet dictator Josef Stalin to describe novelists.)

The novel, whose seven chapters are named after English-language writers, follows Danny’s picaresque adventures through the decades, jumping from his youth in Czechoslovakia to his later life in Canada. Amid the threats and deprivations of life in the Soviet bloc, Danny never loses his cheerful good will as he stumbles from one calamity to another.

Mr. Skvorecky wrote many other well-regarded novels, including “Dvorak in Love,” “The Republic of Whores,” “The Bride of Texas,” and a series of detective novels, but “The Engineer of Human Souls” was recognized as his masterpiece.

“It is, in places, so entertaining that it would be dangerous to read it without laughing aloud; in other places it is sad or dismaying,” critic Richard Eder wrote in the Los Angeles Times. “What he has really written, though, is an epic of his country and its exiles.”

Josef Vaclav Skvorecky was born Sept. 27, 1924, in Nachod, a small city in the Czech region of Bohemia. His father was a bank clerk who later ran a movie theater.

After seeing Judy Garland in the 1937 film “Thoroughbreds Don’t Cry,” the teenage Mr. Skvorecky began to study English in order to write her a fan letter.

“I wrote Judy Garland that letter, but I never heard back from her,” he said in 1985.

About the same time, he became immersed in jazz — “the only revelation I have ever experienced” — and learned to play the tenor saxophone.

During World War II, Mr. Skvorecky was required to work in a German-run munitions factory, but he also began to read Hemingway, F. Scott Fitzgerald, William Faulkner and Raymond Chandler in English. He then studied at Prague’s Charles University, graduating in 1949 and receiving a doctorate in 1951, with a dissertation on Thomas Paine, one of the intellectual forefathers of the American Revolution.

He taught in a girls’ school, served in the Czech army, acted and worked in publishing in his youth. He translated Hemingway, Evelyn Waugh, Chandler and Ray Bradbury into Czech, adapting their styles for his own writing.

“I suddenly saw that you could write dialogue as people spoke it,” he said in 1985. “It opened my eyes.”

After Soviet tanks rolled into Prague in 1968, suppressing the promise of Prague Spring, Mr. Skvorecky and his wife fled Czechoslovakia and settled in Toronto. He taught American literature and film at the University of Toronto until 1990.

“Canada is the country where, for the first time in my adult life, I found freedom,” Mr. Skvorecky said in 2006. “My real country is the Czech language, which is the tongue I learned from my mother.”

He was not widely published in English until the mid-1970s, when British writer Graham Greene suggested to Dennys, his niece, that Mr. Skvorecky’s books were ripe for translation. In 1979, Dennys published “The Bass Saxophone,” which included a memoir and two novellas.

“He was a magical storyteller,” Dennys said in an interview. “His popularity in the Czech Republic remains huge,” Dennys said. “He’s a rock star. He could barely walk down the street.”

Mr. Skvorecky and his wife, who is his sole survivor, closed their publishing business in the early 1990s, after Communism had collapsed in Czechoslovakia.

Although his books helped inspire a younger generation to rebel against a stultified regime of repression, Mr. Skvorecky often claimed he was not motivated by political ideals.

“I have always considered myself an entertainer, a popular writer,” he said. “I never aspired to be one of those wise men who solve the problems of the world.”