Default "would have had a devastating effect on our economy," Obama said at the White House, relaying the news to the American people and financial markets around the world. He thanked the leaders of both parties.
House Speaker John Boehner telephoned Obama at mid-evening to say the agreement had been struck, officials said.
No votes were expected in either house of Congress until Monday at the earliest, to give rank-and-file lawmakers time to review the package.
But leaders in both parties were already beginning the work of rounding up votes.
In a conference call with his rank and file, Boehner said the agreement "isn't the greatest deal in the world, but it shows how much we've changed the terms of the debate in this town."
Obama underscored that point. He said that, if enacted, the agreement would mean "the lowest level of domestic spending since Dwight Eisenhower was president" more than a half century ago.
Senate Democratic leader Harry Reid provided the first word of the agreement.
"Sometimes it seems our two sides disagree on almost everything," he said. "But in the end, reasonable people were able to agree on this: The United States could not take the chance of defaulting on our debt, risking a United States financial collapse and a world-wide depression."