Congress waited until the very day that Treasury Secretary Tim Geithner had said was the drop-dead deadline for raising the $14.3 trillion legal cap on federal borrowing.

The Budget Control Act of 2011 will raise the debt ceiling by between $2.1 trillion and $2.4 trillion -- that's expected to cover Treasury's borrowing needs until 2013.

The legislation will reduce deficits by at least $2.1 trillion over a decade, starting next year. But to do so it will rely most heavily on cuts to discretionary spending, at least initially, since it doesn't include any explicit tax or entitlement reform measures.(Read: Full text of bill)

Instead, the act establishes a bipartisan joint committee of Congress that will have until Nov. 23 to propose ways to reduce deficits. Those proposals must be voted on by Dec. 23.

If the committee process fails to produce debt reduction, as much as $1.2 trillion in across-the-board cuts would kick in -- evenly divided between defense and non-defense spending.

Geithner first gave Congress a heads-up in January that the country's debt load was nearing the cap. Then, in early May, he estimated that by Aug. 2 Treasury could no longer guarantee that it would be able to pay all the country's bills without borrowing money.

That prompted Republicans -- mostly in the House -- to insist they would only vote to raise the ceiling if Congress also cut spending.

In May, House Speaker John Boehner made another Republican demand plain in a speech in New York: The House would insist on spending cuts greater than any debt ceiling increase.

And Republicans also insisted that any deal not raise taxes in any way.

Democrats, led by Obama, pushed back. They said that any debt-reduction bill attached to a measure raising the debt ceiling should include both spending cuts and tax increases.

Months of negotiations led nowhere. One apparent deal after another broke down. Republicans walked away from talks three times in the span of a few weeks.

Meanwhile, concerns about the fallout of a debt ceiling crisis mounted.

The possibility of default got more real the closer the calendar ticked down to August.

The Treasury Department, which manages the country's checkbook, prepared for how it would handle financial obligations if the debt ceiling weren't raised in time.

The debate raised an unthinkable question: Would the United States in effect choose not to pay its bill? Not just to bond investors, who everyone expected Treasury would pay first, but also to individuals like Social Security beneficiaries.

In the end, Congress spared the nation the risk of default. But a downgrade might still happen -- if the rating agencies decide Washington won't be able to put its fiscal house in order in a credible, bipartisan way.