WASHINGTON – The Senate confirmed Gina Haspel Thursday as CIA director, making her the first woman to run the spy agency.

Haspel, who spent three decades at the agency and much of it undercover, earned support from six Democrats after she pledged not to restart waterboarding and enhanced interrogation techniques used in the wake of 9/11.

“There is no question that she is qualified to serve as our next CIA director—if not the most qualified CIA director we’ve ever had,” said Sen. Shelley Moore Capito (R-W.Va.).

“Not only does she have support from both sides of the aisle, as well as former CIA directors serving under both Republican and Democratic administrations, but she is fully committed to the rule of law and the model of integrity and humility.”

The vote for confirmation was 54-45.

Joining 48 Republicans were six Democrats — Joe Donnelly of Indiana, Heidi Heitkamp from North Dakota, Joe Manchin of West Virginia, Bill Nelson of Florida, Jeanne Shaheen of New Hampshire and Mark Warner of Virginia.

Two Republicans voted no: Rand Paul of Kentucky and Jeff Flake of Arizona.

Sen. John McCain, a POW survivor who was home undergoing treatment for cancer, had urged a “no” vote on Haspel for her involvement in the torture program.

Haspel’s contentious confirmation hearing focused on her job in charge of a secret Thailand prison that waterboarded terror detainees and her role in destroying video footage of the torture.

“Someone who refuses to say torture is immoral, and who was engaged in destroying evidence of torture, should not be running the CIA,” said Sen. Kirsten Gillibrand (D-NY).

Haspel stood by the CIA’s work after 9/11 to gain valuable information from detainees, saying it was deemed legal at the time.

But she said she agrees with a higher moral standard and wouldn’t turn to torture, even if directed by President Trump, who has said waterboarding works.

“I would not restart under any circumstances an interrogation program at CIA,” Haspel told the Senate Intelligence Committee last week.