Best known for his "Cairo Trilogy", Mahfouz was awarded the Nobel Prize in 1988 for works that "formed an Arabian narrative art that applies to all mankind".
But he did not receive only plaudits. He was declared an infidel by Muslim militants and al-Azhar, the highest Islamic authority in Egypt, banned his 1959 novel Children of Gabalawi on the grounds that it violated Islamic rules by including characters who clearly represented God and the prophets.
Mahfouz survived a knife attack in 1994 that damaged a nerve and seriously impaired his ability to use his writing hand. "They are trying to extinguish the light of reason and thought. Beware," he said after the attack.
Dignitaries from around the world, including George Bush, the United States president, paid tribute to the author yesterday.
"On behalf of the American people, the president and Mrs Bush extend their deepest sympathies to Mr Mahfouz's family and friends and to the Egyptian people for the loss of an extraordinary artist who conveyed the richness of Egyptian history and society to the world," a White House statement said.
The son of a merchant, Mahfouz was the youngest son in a family of four sisters and two brothers. He obtained a philosophy degree from Cairo University at the age of 23, at a time when many Egyptians had only a primary education. He worked in the government's cultural section until retiring in 1971.
His 1945 book New Cairo combined social criticism and psychological insight to portray living characters in popular quarters of Cairo. It adopted a realistic style that critics say started a new school of Arab writing. Another four such works followed.
Mahfouz stopped writing between 1949 and 1956 while he observed the changes that saw the fall of the monarchy, the end of British rule and the rise of the military under the presidency of Gamal Abdel Nasser. However, he came back full force with a trilogy, narrating developments in Egypt through the eyes of a middle-class family over three generations, that covertly attacked the new army rulers.
In the 1960s, when no Egyptian dared voice dissent, he indirectly criticised Nasser's rule in Small Talk on the Nile and Miramar.
Mahfouz's support of Egypt's 1979 peace treaty with Israel brought him the wrath of many Arab countries, who banned his novels. But many of his works have been made into Arabic films and his books have sold widely across the Arab world.
He publicly opposed Islamic militancy, but before the 1994 assassination bid, he had declined police protection. Two men were hanged in 1995 for the attack.
His funeral is set for today.