Mr. García Márquez’s ties to Mr. Castro troubled some intellectuals and human rights advocates. Susan Sontag wrote in the 1980s, “To me it’s scandalous that a writer of such enormous talent be a spokesperson for a government which has put more people in jail (proportionately to its population) than any other government in the world.”

He attributed the criticism to what he called Americans’ “almost pornographic obsession with Castro.” But he became sensitive enough about the issue to intercede on behalf of jailed Cuban dissidents.

After receiving his cancer diagnosis in 1999, Mr. García Márquez devoted most of his subsequent writing to his memoirs. One exception was the novella “Memories of My Melancholy Whores,” about the love affair between a 90-year-old man and a 14-year-old prostitute, published in 2004.

In July 2012, his brother, Jaime, was quoted as saying that Mr. García Márquez had senile dementia and had stopped writing. Mr. Pera, the author’s editor at Random House Mondadori, said at the time that Mr. García Márquez had been working on a novel, “We’ll See Each Other in August,” but that no publication date had been scheduled. The author seemed disinclined to have it published, Mr. Pera said: “He told me, ‘This far along I don’t need to publish more.’ ”

Dozens of television and film adaptations were made of Mr. García Márquez’s works, but none achieved the critical or commercial success of his writing, and he declined requests for the movie rights to “One Hundred Years of Solitude.” The novel’s readers, he once said, “always imagine the characters as they want, as their aunt or their grandfather, and the moment you bring that to the screen, the reader’s margin for creativity disappears.”

Besides his wife, Mercedes, his survivors include two sons, Rodrigo and Gonzalo.

Mr. García Márquez attributed his rigorous, disciplined schedule in part to his sons. As a young father he took them to school in the morning and picked them up in the afternoon. During the interval — from 8 in the morning to 2 in the afternoon — he would write.

“When I finished one book, I wouldn’t write for a while,” he said in 1966. “Then I had to learn how to do it all over again. The arm goes cold; there’s a learning process you have to go through again before you rediscover the warmth that comes over you when you are writing.”