The epic opens during Charlemagne's campaign in Spain, where the Muslim king Marsile of Zaragoza sends deceptive emissaries offering tribute and feigned conversion to trick the French into leaving. Influenced by the traitor Ganelon, who bears a bitter grudge against his stepson Roland, the French council accepts the terms and chooses Ganelon to deliver the reply. During his embassy, Ganelon conspires with the pagans, plotting to ambush Roland and his companion Oliver in the narrow passes of the Pyrenees. When the army prepares to cross back into France, Roland is named to command the rear guard with twenty thousand men, rejecting advice to sound his olifant horn for reinforcements until it is too late.
The devastating battle at Roncevaux begins with fierce valor, but the overwhelming pagan numbers slowly decimate the Frankish forces, including the wise Oliver and the militant Archbishop Turpin. Roland finally sounds his horn with such force that it bursts his temples, alerting Charlemagne, before he dies a hero's death atop a mound under two trees, holding his sword Durendal and his glove toward heaven. Charlemagne returns to find the horrific carnage, grieves deeply over his fallen peers, and immediately pursues the retreating pagans, whom God helps destroy by making the sun stand still and drowning them in the river Ebro.
After receiving reinforcements led by the massive pagan admiral Baligant, Charlemagne engages in a prolonged single combat with him, ultimately splitting his helmet and killing him to secure total victory. Returning to Aix, the emperor presides over the trial of the traitor Ganelon, whose kinsman Pinabel champions him in a judicial duel against the loyal knight Thierry. Thierry slays Pinabel in single combat, proving Ganelon's guilt, and the traitor is subsequently torn apart by wild horses while his thirty kinsmen are hanged. The poem concludes with Charlemagne mourning his losses, baptizing the captive Queen Bramimunde, and receiving a divine nocturnal summons from the angel Gabriel to march off to yet another war.