El Cid married the cousin of King Alfonso VI, Doña Ximena, but for certain reasons (according to the story, he made the king swear by Santa Gadea that he had not ordered the fratricide of his own brother), he fell into the disfavor of the king and had to leave his home country of Castile.
The story begins with the exile of El Cid, whose enemies had unjustly accused him of stealing money from the king, Alfonso VI of Castile and León, leading to his exile. To regain his honor, he participated in the battles against the Moorish armies and conquered Valencia. By these heroic acts he regained the confidence of the king and his honor was restored. The king personally marries El Cid's daughters to the infantes (princes) of Carrión. However, when the princes are humiliated by El Cid's men for their cowardice, the infantes swear revenge. They beat their new wives and leave them for dead. When El Cid learns of this he pleads to the king for justice. The infantes are forced to return El Cid's dowry and are defeated in a duel, stripping them of all honor. El Cid's two daughters then remarry to the infantes of Navarre and Aragon. Through the marriages of his daughters, El Cid began the unification of Spain.
Unlike other European medieval epics, the tone is realist. There is no magic, even the apparition of archangel Gabriel (verses 404–410) happens in a dream. However, it also departs from historic truth: for example, there is no mention of his son, his daughters were not named Elvira and Sol and they did not become queens.
It consists of more than 3,700 verses of usually 14 through 16 syllables, each with a caesura between the hemistiches. The rhyme is assonant.
Since 1913, and following the work of Ramón Menéndez Pidal, the entire work is conventionally divided into three parts:
Cantar del Destierro (verses 1–1086)
El Cid is exiled from Castile by King Alfonso VI and fights against the Moors to regain his honor.
Rodrigo Diaz de Vivar, who is called Mío Cid (meaning My Lord) by the Moors. His current task is to collect the tributes from the Moorish territory owed to his king, Alfonso VI of Leon. Cid's enemy accuses him of taking some of these tributes and the king exiles him from Leon and Castilla. Before he leaves, he places his wife, Doña Ximena, and his two daughters, Doña Elvira and Doña Sol, in the Monastery of Cardeña. The canto then gives accounts of raids in the Moorish territory in which Cid and his men get rich off of the spoils.
Cantar de las bodas de las hijas del Cid (verses 1087–2277)
El Cid defends the city of Valencia, defeating King Yusuf ibn Tashfin of the Almoravids. El Cid restores his honor and grants his daughters permission to marry the infantes of Carrión.
It begins with Cid's capture of the city of Valencia. He brings his family to live with him. It is discovered that the Infantes (princes) de Carrión, the nephews to the king, are the enemies who caused Cid's exile. They plot to marry his daughters to take some of his wealth. The king acts on behalf of his nephews and pardons Cid and allows the marriages. Cid suspects that something bad will happen from the marriages but he allows it anyway.
Cantar de la Afrenta de Corpes (verses 2278–3730)
The infantes of Carrión were put on shame after being scared of a lion roaming in the court and running away from a campaign to fight against the Moors. So, in revenge, they decide to abuse and abandon their wives at the roadside in Corpes, tied to trees. Once more, El Cid has to gain his honor back, so he asks the court of Toledo for justice. The infantes are defeated in a duel by El Cid's men, and his daughters remarry to the infantes of Navarre and Aragon.
The Cantar shows that the Infantes are cowards in battles with the Moors. They are made fun of and decide to get revenge by attacking their wives. They set out for Carrión with their wives and an escort, Felix Muñoz, the cousin of the daughters. Once on the journey, they send the escort ahead of them, steal their wives' great dowries (including two beautiful swords) and beat them and leave them for dead. Muñoz suspects trouble and returns to his cousins and takes them to receive help. Cid seeks to right the wrongs done to his daughters, and a trial is held. A duel is held between some of Cid's men and the Infantes in which the Infantes lose. In the middle of the trial, a message is sent from the kings of Navarra and Aragon, proposing to marry their sons to Cid's daughters. These marriages take place after the defeat of the Infantes and near the end of the story.