A Storm of Swords continues the story where A Clash of Kings ended. The novel describes the increasingly vicious War of Five Kings in Westeros, Daenerys’s strengthening forces in the East, and the oncoming threat of the Others, a ghostly army that is nearly invincible. The story is told from the perspective of 12 different characters, though 10 tell the majority of the story. Their tales occur simultaneously, as the chapters cycle among their perspectives, though here they are recounted one at a time.

The novel opens with a prologue. Chett, a sworn brother of the Night’s Watch, has decided to murder his superiors and desert his post. But before he can carry out his plan, a vast army attacks the Wall, a massive structure designed to repel northern invaders. Chett fears that the invasion may be successful, for the first time in generations.

In the city of King’s Landing, Tyrion Lannister recuperates. At the end of the previous novel, he was involved in a massive battle in which he showed great courage and was seriously wounded. As he recovers, he tries to win the favor he feels his family owes him, but to little effect. His father, Tywin, continues to disparage him, and his sister, Cersei, despises him as much as ever. Tyrion does little to hide his disapproval of his family and the reign of King Joffrey, his nephew. Meanwhile, Tyrion has been carrying on a secret relationship with Shae, a prostitute he has disguised as a castle maid. The relationship becomes complicated when Tyrion, for political reasons and much against his will, is married to 13-year-old Sansa Stark. Tyrion refuses to consummate the marriage with the terrified young Sansa, who for some time has been a hostage to the Lannisters and subjected to endless mistreatment.

During this time, King Joffrey has been engaged to marry Margaery Tyrell in order to create an alliance between their two houses. But on the night of his wedding, Joffrey is poisoned, and Tyrion is immediately accused of the crime. He chooses trial by combat, but his champion is killed, condemning Tyrion to death. As he waits in jail, Shae quickly forgets him. Then, just before his execution, his recently returned brother, Jaime, rescues him. Jaime admits to having lied to Tyrion in the past about a woman that Tyrion once married, but who Tywin in disapproval had his soldiers rape to drive her off. Jaime told Tyrion at the time she was a prostitute he had paid to sleep with Tyrion, but he now reveals to Tyrion that she was just a crofter’s daughter and her marriage to Tyrion wasn’t purchased. Tyrion is furious and swears revenge. Before he flees for good, he gains access to his father's room via a secret passageway. He finds Shae there. He strangles her first, then discovering his father in the bathroom, kills him with a crossbow.

Sansa is also suspected of having been involved in Joffrey's murder. In fact, she had been planning to escape with the help of a knight whom she had once saved from Joffrey's wrath. On the night of Joffrey's wedding, immediately after Joffrey is killed, the knight takes her out to a waiting ship. Sansa is shocked to find on board the devious and charismatic Petyr Baelish, who reveals that the poison was smuggled into the wedding feast in Sansa’s hairnet. They escape to the castle Baelish shares with his wife, Lysa, who is also Sansa's aunt. There, Sansa is betrothed to the sickly young Robert, her own cousin. One day, as Sansa builds a snow castle during a snowstorm, Baelish tries to kiss her. Lysa becomes suspicious, and when she angrily confronts Baelish, he murders her. But with Sansa's help, he is able to convince everyone her death was an accident.

Arya Stark, having escaped capture by the Lannisters, is trying to get to Riverrun, but she is soon taken captive by a band of outlaws. When they capture Sandor Clegane, a vicious former henchman of the Lannisters called the Hound, Arya wants him killed, but after winning a trial by combat, the Hound is freed. Arya runs away from the group, but the Hound finds and kidnaps her, taking her with him. They travel to a fortress called the Twins, where Arya’s brother Robb will be married, but they arrive just as assassins kill Robb and slaughter his court. The Hound takes Arya to an inn. It's his rendezvous point with the Tickler and Polliver, men Arya encountered in the previous novel and also wants dead. In a drunken quarrel, the Hound kills the two men but is critically wounded himself. He begs Arya to kill him, but she abandons him to die. She rides to Saltpans, a seaside town, where she boards a ship for the city of Braavos.

His ship having sunk in the massive battle that concluded A Clash of Kings, Ser Davos Seaworth begins the novel stranded on a small island until a passing ship rescues him. When he arrives at Dragonstone, where his king, Stannis Baratheon, has made his seat, Davos tries to kill Melisandre, a cunning priestess whom Davos blames for the disastrous battle that sunk his ship and killed his sons. Melisandre anticipates Davos's move and imprisons him. Rather than execute him, however, Stannis, with Melisandre's approval, makes Davos his “Hand,” or most trusted advisor. Davos remains skeptical of Melisandre, and when he learns that Edric Storm will be sacrificed to the god R’hllor at Melisandre’s bidding, Davos helps Edric escape. He then convinces King Stannis to help the Night’s Watch repel the northern invasion.

Because she released Ser Jaime Lannister, her family's sworn enemy, without the permission of her son Robb, the King in the North, Lady Catelyn Stark is accused of treason. She freed Jaime with the understanding that he would return her daughters, Sansa and Arya, to her, so Robb forgives her. He also reveals that he married Jeyne Westerling, despite having promised to marry one of Lord Walder Frey's daughters in order to solidify an alliance between their families. Everyone knows it was a disastrous lapse in judgment. Robb tries to mend ties by marrying Catelyn’s brother, Edmure, to Roslin, a Frey daughter. At Edmure’s wedding, however, Frey assassins massacre the Stark court, including Robb and Catelyn, in what is infamously called the Red Wedding. Three days after her death, Catelyn reappears, horribly scarred, unable to speak, and seething for vengeance.

Ser Jaime Lannister, meanwhile, is on his way back to King's Landing after being released by Catelyn Stark. He is not entirely free; he is shackled and escorted by Brienne of Tarth, a tough and extremely dutiful woman who promised to see Jaime safely home and bring Catelyn's daughters back to her. Jaime and Brienne come to respect one another despite being adversaries. Eventually Brienne and Jaime are recognized and abducted on the road, and one of the captors cuts off Jaime's sword hand. It is a tremendous blow to Jaime, who has shaped his whole life and identity around being a skilled swordfighter and knight. They are taken to the court of Lord Bolton, who releases Jaime to win favor with the Lannisters. As Jaime is leaving, he sees Brienne fighting unarmed against a bear for the amusement of her captors and rescues her. When Jaime returns to the House of Lannister, he is restored to the Kingsguard and has a dramatic change of heart about himself. Previously selfish and uninterested in honor, he now wishes to change his legacy. He shows concern for Brienne and Sansa Stark, his relationship with his twin sister and lover Cersei falls apart, and he betrays his family by rescuing Tyrion from execution.

Meanwhile, in the far north, Jon Snow, a bastard child of the Stark family and member of the Night's Watch, pretends to join the wildlings, or the free people who live north of The Wall. At the end of the previous novel, Jon and his commander were captured by the wildlings, and Jon was instructed to feign joining them to gather information. Jon becomes close with Mance Rayder, a former brother of the Night’s Watch and leader of the wildlings. He learns that a horde of undead creatures called the Others has begun moving south, which is why the wildlings are heading toward The Wall. He also starts a relationship with Ygritte, a wildling woman, and falls in love with her. Eventually Jon escapes, and upon making it back to The Wall, reveals the wildlings’ intention to invade. When the invasion comes, Jon bravely helps lead the defense, but a faction of the Watch with a personal grudge against him accuses him of being a traitor and imprisons him. He is told he can only prove his loyalty by killing Mance Rayder, which is essentially a suicide mission. While the wildlings continue to siege The Wall, King Stannis arrives with his forces and drives the wildlings off. Stannis has Jon freed and offers to make him the Lord of Winterfell, a title Jon could never have held because he was a bastard. At the same time, he is chosen by his brothers as the new Lord Commander of the Watch since the previous one has died, and he must decide whether he wants to rule over Winterfell or remain in the Watch. He chooses the Night's Watch.

When the book begins and Jon Snow is with the wildlings, his friend Samwell Tarly is also north of The Wall. He is on a ranging expedition with his brothers in the Watch when their company is attacked by undead creatures referred to as the Others. The cowardly Sam manages to kill an Other with an obsidian blade and he realizes they are vulnerable to obsidian and fire. He and a small number of men survive the battle, and they go to Craster’s Keep. While there, a mutiny breaks out and some men kill the Watch's Lord Commander, Mormont. Sam escapes with Gilly, whose newborn baby he has sworn to protect. They are chased by Others and are ultimately rescued by a mysterious undead man called Coldhands. When they return to The Wall and Castle Black, it is Sam who convinces the Night’s Watch to elect Jon Snow as Lord Commander.

Having escaped from Winterfell in the last novel, Bran Stark, meanwhile, is on the run with his caretakers Hodor, Meera, and Jojen. He feels driven to head north to The Wall because of a recurring vision he has. While they march, Bran, who is a warg, or skinchanger, spends more and more time inside the mind of his wolf, Summer, as his supernatural abilities continue to grow stronger. Ultimately they arrive at The Wall and meet the mysterious Coldhands, who takes them through it via the ancient Black Gate.

In the east, Daenerys Tagaryen needs to raise an army to invade Westeros and reclaim her crown. Ser Jorah Mormont, her guardian and advisor, tells her she can buy a slave army in Slaver's Bay, a region where slavery is common that includes the cities of Astapor, Yunkai, and Meereen. In Astapor, at Ser Jorah's behest, she purchases a massive troupe of Unsullied, eunuch slave warriors who are skilled and fearless fighters, though she is horrified by the way they are raised and trained. Immediately after buying them, she turns them against their former masters and has all the slaves in the city set free. She and her new force then march on Yunkai, where the rulers, unable to contend with Daenerys's army, relinquish their slaves to her.

Lastly she turns to Meereen, and as they approach the city they find the Meereenese have nailed a slave child to a post every mile along the road. The city has massive walls though, and there is no obvious way to take the city. While they are encamped in front of it, Daenerys learns that her closest aides, Arstan Whitebeard and Ser Jorah Mormont, have lied to her. Whitebeard is actually Ser Baristan Selmy, a former knight of the Kingsguard who sought out Daenerys as the rightful ruler of the Seven Kingdoms. He didn't reveal himself because before pledging himself to her he first wanted to make sure she wasn't mad, like some of her ancestors had been. Ser Jorah, on the other hand, had been selling information on her to spies from Westeros, though he stopped some time ago. Daenerys offers them a chance to redeem themselves by sneaking into Meereen through the sewers and opening the doors. They succeed and Daenerys's army takes the city. She forgives Ser Barristan, but Ser Jorah's betrayful is too painful and she banishes him. Reports come back that a new ruler has taken over Astapor, and that he is more brutal to the slaves than those who ruled before. Feeling she can't abandon those whom she freed, Daenerys decides to stay in Meereen and rule as queen.