- "It was reforged from Ned Stark's sword. You'll use it to defend Ned Stark's daughter."
- ―Jaime Lannister to Brienne of Tarth
Oathkeeper is one of two Valyrian steel longswords made from Ice, the greatsword of House Stark, under orders of Lord Tywin Lannister. While initially given to Jaime Lannister by Lord Tywin with the intention of making it an heirloom of their house, Jaime instead gave it to Brienne of Tarth for the task of rescuing Sansa Stark. Its sister blade is Widow's Wail.
Tywin gives the sword to his son Jaime, intending for him to be released from his vows as Lord Commander of the Kingsguard and rule over Casterly Rock in his stead. When Jaime refuses, Tywin lets him keep the sword anyway and tells him that a one-handed man without family (implying Jaime had been disowned) needs all the help possible.
Following King Joffrey's death, Jaime tasks Brienne with finding Sansa Stark and get her somewhere safe before Cersei locates her. As a parting gift he gives her the sword, as he knows it was reforged from Ice, so she can protect Ned Stark's daughter with Ned Stark's own blade. She considers a name for a few moments, before choosing "Oathkeeper".
When Brienne and Podrick encounter Arya Stark and Sandor Clegane, Oathkeeper's obvious Lannister qualities (the hilt is a golden lion) prompt Arya and Sandor to be suspicious of Brienne. When the situation turns hostile, Brienne uses Oathkeeper in combat for the first time against Sandor. However, she wins the duel by knocking Sandor off a cliff after brutal hand-to-hand combat.
Still in the Vale, Oathkeeper remains in Brienne's possession. After an encounter with Sansa Stark and Petyr Baelish turns hostile, Brienne kills three of the guards that attempt to pursue them with Oathkeeper. The Valyrian steel sword is strong enough to slice through the sword of one of the guards. Brienne later uses Oathkeeper to execute Stannis Baratheon when she finds him after the Battle of Winterfell. 
Brienne and Podrick arrive at the Wolfswood in time to rescue Theon Greyjoy and Sansa Stark from the Bolton soldiers sent by Ramsay Bolton after they escaped from Winterfell. Brienne uses Oathkeeper to slay several soldiers while Podrick and Theon dispatch the rest. After the battle, Brienne lays Oathkeeper at Sansa's feet and pledges fealty to her. Sansa accepts Brienne's service.
At Sansa's request, Brienne and Podrick travel to Riverrun, which Sansa's great-uncle the Blackfish has recently retaken, to persuade him to join Sansa and Jon in their quest to retake Winterfell for the Starks. They find Jaime Lannister and his army encamped around the castle, and Brienne meets with him to bargain for a meeting with the Blackfish, in hopes she can convince him to leave Riverrun peacefully to aid Sansa in the North. She offers Oathkeeper back to Jaime, saying it was given to her for a purpose (to get Sansa to safety), and now that the purpose has been achieved, it should go back to him. Jaime replies: "It's yours. It will always be yours."
Brienne and Podrick are granted safe passage and entry to Riverrun and present Sansa's letter to Brynden Tully, who refuses to read it at first and accuses Brienne of being in league with Jaime Lannister, noting her "sword with the gold lion on the pommel". Brienne counters that Jaime gave her the sword so she might fulfill the vow he made to Catelyn to get her daughters to safety. After giving in and reading Sansa's letter, Brynden tells Brienne he cannot help Sansa if it means losing his ancestral home again. Brienne has Podrick send a raven to Winterfell to let Sansa know of the Blackfish's refusal to help. When Edmure Tully is used by Jamie Lannister to open the gates of Riverrun to the Lannister and Frey forces, the Blackfish sneaks Brienne and Podrick into a boat to safety. As they row away, Brienne sees Jamie watching from the battlements. He waves farewell, and she waves back.
In the books
In the A Song of Ice and Fire novels, the sword is forged by Tobho Mott along with Widow's Wail. The sword has black and red ripples through the steel. Its scabbard glitters gold and is decorated with a row of lion's heads and smoldering red rubies. The pommel has a golden lion's head with ruby eyes that shine like two red stars.
Jaime is angry when the sword is given to him, thinking that it is a cruel joke of his father and uncle given that such a blade would be wasted on him, since he has lost his right hand (akin to giving expensive boots to a legless man). Kevan is upset to hear how Jaime feels about the sword, saying the gift was heartfelt, but Jaime is not mollified.
After returning to King's Landing, a short time after the Purple Wedding, Jaime and Brienne are stopped by Ser Loras Tyrell, who believes that Brienne was responsible for Renly's death. Jaime orders Brienne to be locked up for her own protection, thus when Jaime gives her sword she is in a tower cell, not the White Sword Tower. He also suggests the name "Oathkeeper" to her, claiming it is appropriate that she will be defending Ned Stark's daughter with Ned Stark's own steel.