The deal, if passed next week by Congress as planned, would end an embarrassing two-week stretch of headlines on GOP infighting and allow the president to begin prosecuting terrorists linked to the Sept. 11, 2001, terrorist attacks.
"I'm pleased to say that this agreement preserves the single most potent tool we have in protecting America and foiling terrorist attacks," the president said after agreement was announced on one of his top remaining priorities of the year.
Mr. Bush said he hopes the legislation passes before Congress adjourns next week, reports CBS News White House correspondent Mark Knoller.
The agreement contains concessions by both sides, though the White House yielded ground on two of the most contentious issues: It agreed to drop a provision that would have narrowly interpreted international standards of prisoner treatment and another allowing defendants to be convicted on evidence they never see.
The accord, however, explicitly states that the president has the authority to enforce Geneva Convention standards and enumerates acts that constitute a war crime, including torture, rape, biological experiments, and cruel and inhuman treatment.
The agreement would grant Congress' permission for Mr. Bush to convene military tribunals to prosecute terrorism suspects, a process the Supreme Court had blocked in June because it had not been authorized by lawmakers.
During those trials, coerced testimony would be admissible if a judge allows and if it was obtained before cruel, inhumane and degrading treatment was forbidden by a 2005 law.
The central sticking point had involved a demand from McCain, Warner and Sen. Lindsey Graham for a provision making it clear that torture of suspects would be barred. The three gathered in the afternoon to work out language for the deal, reports CBS News correspondent Sharyl Attkisson.
"The integrity and letter and spirit of the Geneva Conventions have been preserved," said McCain after the agreement was announced.
Republicans used the deal on detainee treatment to put the heat back on Democrats as lawmakers prepare to leave Washington at the end of the month to campaign for the Nov. 7 midterm elections.
Republicans are fighting to maintain their majority in Congress by touting their toughness on national security issues, while Democrats are pointing to the violence in Iraq and high cost of the war as GOP blunders.
House Majority Leader John Boehner, R-Ohio, said Democrats can either work with Republicans to preserve the CIA interrogation program for high-value terrorism suspects or "continue to oppose every responsible effort to provide President Bush with the tools he needs to keep America safe."
But Democrats have said they support the measure as long as the plan is sound.
"No blank checks, no vague terms," said California Rep. Jane Harman, the top Democrat on the House Intelligence Committee. Harman, as the panel's senior Democrat, is one of four members of Congress who had extensive, classified briefings on the CIA detention and interrogation program.
The agreement was hailed by human rights groups and seen by many as the president caving in when his usual Republican support crumbled. But White House officials said the end result includes enough legal protection for the CIA program to continue.
"The program will go forward" and "the men and women who are asked to carry out that program will have clarity as to the legal standard, will have clear congressional support, and will have legal protections as we ask them to do this difficult work," said Stephen Hadley, the president's national security adviser.
After weeks of stalled talks, Senate leaders Thursday morning demanded resolution of the impasse over the detainee legislation. Warner, McCain and Graham met with administration officials throughout the day, finally emerging with an agreement in which both sides claimed victory.
Other members had not been briefed and at least one House conservative is likely to oppose the provision requiring evidence be divulged to a defendant, out of concern it could expose classified information.
"We want to have the ability to have these tribunals to prosecute the terrorists who right now are waiting at Guantanamo," Rep. Duncan Hunter, R-Calif., chairman of the House Armed Services Committee, said of the prisoners held at Guantanamo Bay, Cuba.
The deal doesn't sit well with everyone. The American Civil Liberties Union is calling on Congress to reject the compromise, which it says does not meet international treaty obligations and fails to protect the due process rights of suspects.
The president's other priority in the war on terror involves legislation to explicitly allow wiretapping without a court warrant on international calls and e-mails between suspected terrorists in the United States and abroad.
One official said Republicans had narrowed their differences with the White House over that issue, as well, and hoped for an agreement soon.
About 450 terrorism suspects, most of them captured in Afghanistan and none of them in the U.S., are being held by military authorities at Guantanamo Bay. Ten have been charged with crimes.