The US Senate has approved the CIA's first female director, despite her role in the spy agency's post-9/11 interrogation programme.
Gina Haspel's confirmation in a 54-45 vote follows a partisan fight among senators about the CIA's Bush-era use of techniques such as waterboarding.
Ms Haspel, a CIA veteran, once oversaw a so-called black site in Thailand after the 11 September 2001 attacks.
The former CIA chief, Mike Pompeo, left to become US Secretary of State.
Republican Senator John McCain - who was tortured during his more than five years in a Vietnamese prison - had earlier announced his opposition to US President Donald Trump's nominee.
On Thursday, six Democrats crossed party lines to vote in her favour.
One of them, Virginia Senator Mark Warner, said Ms Haspel had told him the agency should never have resorted to so-called enhanced interrogation techniques.
He said she had pledged never to use such methods even if the president demanded it.
"I believe she is someone who can and will stand up to the president, who will speak truth to power if this president orders her to do something illegal or immoral, like a return to torture," he said in a speech before the vote.
Two Republicans - Jeff Flake and Rand Paul - voted against Ms Haspel, meaning she would not have been confirmed without support from Democrats.
A 33-year-veteran of the agency, Ms Haspel, 61, spent most of her career as an undercover operative.
In 2002, she was selected by the agency to run a "black site" in Thailand where harsh interrogation techniques were used that a Senate report deemed to be torture.
One suspect that was brought there, Abd al-Rahim al-Nashiri, was brutalised using methods that were later banned by President Barack Obama.
Al-Nashiri, who was interrogated after Ms Haspel took over the post, was also subjected to sleep deprivation, nudity, extreme temperatures, being held in a small box, and "walling" (being slammed repeatedly into a wall).
Three years later, Ms Haspel ordered the destruction of 92 video tapes that documented the interrogation of him, and Abu Zubaydah, who was also held at the Thai location.
At least 119 men were tortured by the US in the aftermath of the attacks on the World Trade Center and Pentagon, according to a 2014 Senate report.
Human rights groups say Ms Haspel left Thailand to oversee further US torture, but it is unclear what role she played as her exact record has been classified by the CIA.
Mr Trump has previously called for the US to resume waterboarding terrorism suspects.