Washington - President Barack Obama won passage by the Congress early on Friday of legislation that lifted the threat of a default on government debt through the end of his presidency and a budget blueprint easing strict spending caps through September 2017.

The Senate voted 64-35 to approve the measure, which was negotiated over the past few weeks by the White House and congressional leaders, including newly retired former House Speaker John Boehner.

Obama is expected to sign the bill into law promptly.

Without action by Congress, the Treasury Department would have exhausted the last of its borrowing capacity on Nov. 3, according to Secretary Jack Lew. That, in turn, risked a default on U.S. obligations within days that would roil global financial markets.

The two-year budget provision provides new top-line spending levels for Congress for the fiscal year that began Oct. 1 and the one starting Oct. 1, 2016.

It loosens budget caps, allowing an additional $80 billion in spending on military and domestic programs over the two years.

But lawmakers still need to allocate that money among thousands of budget line items. They face a Dec. 11 deadline, when existing spending authority by government agencies expires, and a spirited fight is expected.

Conservative Republicans are likely to try to attach some controversial policy add-ons, such as prohibiting funding for women’s healthcare provider Planned Parenthood to punish it for its abortion activities.

Some may also try to undo “Dodd-Frank” Wall Street reforms enacted after the 2008-09 financial crisis or prohibit new regulations on carbon emissions.

During Senate debate on Thursday, conservatives railed against the budget and debt limit bill.

Republican Senator Rand Paul, who is running for president, complained in a floor speech: “The right’s going to get more military money. The left’s going to get more welfare money. The secret handshake goes on and the American public gets stuck with the bill.”

Senator Ted Cruz, a rival Republican presidential candidate, returned to Washington from the campaign trail to accuse Republican majorities in Congress of “handing the president a blank credit card for the remainder of his tenure.”

Senate Majority Leader Mitch McConnell, a Republican who helped negotiate the bill, praised the measure for rejecting tax increases and noted that the added spending would be offset by savings elsewhere in the government.

He also said it would “enact the most significant reform to Social Security since 1983.” The estimated $168 billion in long-term savings from the program would be achieved by clamping down on medical fraud and excess claims associated with disability benefits.