The Libro de los Enxiemplos del Conde Lucanor et de Patronio ("Book of the Exempla of Count Lucanor and of Patronio", usually just called "El Conde Lucanor" for short) is a fourteenth-century book of stories in the medieval genre known as the exemplum. An exemplum is a short anecdote about people with an obvious moral, told to illustrate some philosophical point; El Conde Lucanor is full of examples of the genre which shed light on its grand diversity of sources.
In El Conde Lucanor, the eponymous count is presented as having some problem in his life, and going to his advisor Patronio for assistance. In each case, Patronio tells him an exemplum, and the count realizes how it applies to his situation; in each case, the story is then told to Don Juan Manuel (author of El Conde Lucanor), who sets it in writing and adds a rhyming couplet which states the moral.
The origins of the exemplum tradition are perhaps most readily traced to the fables of Aesop, but their popularity in the high and late medieval period comes from collections which circulated among clergy, who often used them as a basis for their sermons. Indeed, many exempla are retellings of Aesop's fables; though the exemplum genre is usually held to be about human characters and is contrasted with animal fables, Aesop wrote both sorts and many of his animal stories were retold with human characters. Indeed, a number of Aesop's fables are found in some form in El Conde Lucanor.
Another source is simple folktales, reworked to emphasize their moral aspects. Many of the stories are well-traveled chestnuts; in fact, quite a few are of Arabic, Persian, or Indian origin. Indeed, everything I've said before about the Decameron applies here also; again, the Panchatrana seems to be the original source for many of the stories Patronio tells his patron. And, also like the Decameron, El Conde Lucanor represents a deliberately literary retelling of stories circulating in the oral tradition. (While the Decameron's style is far more deverse, it contains a number of exempla; the two books even have a few stories in common between them.)
The morals themselves shine a lot of light on how the fourteenth-century reader was expected to understand the stories; in some cases, they're rather at odds with the themes a modern critic would find most evident in the tale. For example, in one story, a man marries a strong-willed woman and feigns an almost homicidal insistence on getting his way in all things until she submits to him properly, while another man who hears about this is unable to get any effect trying the same tactic with his wife of many years. While to us this might be a tale of emotional abuse and the intimidation of wives, to Juan Manuel the moral was crystal clear: you can't change a first impression.
Indeed, it is perhaps Juan Manuel's rhyming summaries of the morals which shed the most light on the cultural context for the publication of El Conde Lucanor. We are given not only the stories themselves, which had been in the oral tradition for many generations and through many shifts in culture, but we also get a direct statement of the interpretation a Spaniard gives them in compiling a book of such parables in the years immediately prior to the Black Death. But the book itself also sheds light on how the exemplum tradition was seen, for it revolves around a character understood as a wise councilor for whom these tales are his primary way of teaching important moral lessons. It is likely that they are intended nearly as much to help the readers learn how to present moral wisdom (or at least to be a handy aid in doing so) as to help them discover it.