The move was a reversal for the president, who had resisted such legislation.
Mr. Bush, speaking during a meeting with McCain at the White House, said the agreement will "make it clear to the world that this government does not torture."
Additional language to the amendment obtained by CBS News chief White House correspondent John Roberts sought to provide a defense to protect U.S. officials authorized to interrogate persons believed to be a threat and thought to be legal. The amendment states: "It shall be a defense that such officer, employee, member of the Armed Forces or other agent did not know that the practices were unlawful and a person of ordinary sense and understanding would not know the practices were unlawful." Click here to read the full text.
CBS News correspondent Bob Fuss reports the White House bitterly fought the measure for months, threatening a presidential veto of any bill containing the torture ban and sending Vice President Cheney to personally lobby to exempt the CIA.
But congressional sentiment was overwhelmingly in favor of the ban, and McCain, a former Navy pilot who was held and tortured for five and a half years in Vietnam, adopted the issue.
Under the deal, CIA interrogators would be given the same legal rights as currently guaranteed members of the military who are accused of breaking interrogation guidelines. Those rules say the accused can defend themselves by arguing it was reasonable for them to believe they were obeying a legal order.
"We've sent a message to the world that the United States is not like the terrorists," McCain said, sitting next to the president in the Oval Office.
The Republican maverick and the administration have been negotiating for weeks in search of a compromise, but it became increasingly clear that he, not the administration, had the votes in Congress.
Mr. Bush called McCain "a good man who's honored the values of America."
"We have worked very closely with the senator and others to achieve that objective as well as to provide protections for those who are the front line of fighting the terrorists," Mr. Bush said.
After the deal was announced, Rep. Duncan Hunter, R-Calif., chairman of the House Armed Services Committee, said he would block completion of one of the two defense bills that includes the ban unless he got White House assurances that "the same high level of effective intelligence gathering" would be achieved if the agreement became law.
But Hunter's spokesman said the chairman spoke with intelligence director John Negroponte and "received the assurances he needs" and would move the bill forward.
As passed by the Senate and endorsed by the House, McCain's amendment would prohibit "cruel, inhuman or degrading treatment or punishment" of anyone in U.S. government custody, regardless of where they are held. It also would require that service members follow procedures in the Army Field Manual during interrogations of prisoners in Defense Department facilities.
In discussions with the White House, that language was altered to bring it into conformity with the Uniform Code of Military Justice. That says that anyone accused of violating interrogation rules can defend themselves if a "reasonable" person could have concluded they were following a lawful order.
Officials say the language also now includes a specific statement that those who violate the standards will not be afforded immunity from civil or criminal lawsuits.
In recent weeks, the administration had sought to add language that would offer protection from prosecution for interrogators accused of violating the provision. But McCain rejected that, arguing it would undermine the ban by not giving interrogators reason to follow the law.
Earlier this year, the Senate included McCain's original provisions in two defense bills, including a must-pass $453 billion spending bill that provides $50 billion for the Iraq war. But the House omitted them from their versions, and the bills have been stalled.
Negotiations intensified this week, with Congress under pressure to approve at least the spending bill before adjourning for the year.
Supporters of the provisions say they are needed to clarify current anti-torture laws in light of abuses at Abu Ghraib in Iraq and allegations of misconduct by U.S. troops at the detention center at Guantanamo Bay.
They also say that passing such legislation will help the United States repair an image they say has been tarnished by the prisoner abuse scandal.
"The fog of law is finally lifting. America's moral black eye is finally healing," Rep. Jane Harman of California, the top Democrat on the House Intelligence Committee, said in a statement.
The White House long has contended that the United States does not engage in torture.