John Boehner (R-Ohio), right, wanted to finish up a budget deal before his successor as speaker took over. The House on Thursday elected Rep. Paul D. Ryan (R-Wis.), left, speaker. (Jahi Chikwendiu/The Washington Post)

The Senate is poised to clear a bipartisan two-year budget deal that would increase spending limits and avert a damaging default, essentially ending the budgetary battles that have defined President Obama’s relationship with Congress in recent years.

The final vote on the bill is likely to take place very early Friday morning, depending on whether conservative senators opposed to the agreement allow it to be moved up. The legislation cleared a procedural measure shortly after 1 a.m. by a vote of 63-35, all but ensuring that the deal will later be approved in a simple majority vote.

The agreement, which was unveiled earlier this week, is the result of tightly held negotiations between congressional leaders in both parties and the White House.

There was pressure to strike a deal soon because of two approaching deadlines – one fiscal, one political.

The Treasury Department has warned that the government will run out of borrowing authority by Nov. 3 and a failure to raise the debt ceiling could lead to an economy rattling default. The bill would suspend the debt ceiling through March 2017.

[Rand Paul may hate the budget deal but he can’t stop it now]

The second deadline was the end of this month, when former Speaker John A. Boehner (R-Ohio) planned to step down from Congress after too many fights with a band of conservatives in his party.

Boehner said he wanted to “clean out the barn” before handing over the gavel, rather than leave his successor with a pile of messy budget business to handle just as they assumed the job. On Thursday, the House elected Rep. Paul D. Ryan (R-Wis.) speaker, a day after the House passed the budget agreement on a 266 to 167, which served as a coda to Boehner’s tenure as speaker.

The agreement would lift the so-called sequester spending caps and increase discretionary spending by about $80 billion over two years, an amount that would be split equally among defense and domestic programs. To offset this cost, negotiators tapped a number of sources, including by making changes to Medicare and Social Security, auctioning off wireless spectrum controlled by the government, selling crude oil from the Strategic Petroleum Reserve and tightening tax rules for business partnerships.

In addition, the legislation would limit a historic premium increase for some Medicare Part B beneficiaries set to go into effect next year for services like hospital care and doctor visits.

The agreement also would prevent a potential 20 percent across-the-board cut to Social Security Disability Insurance benefits that is also set to take place next year, by transferring some funding from the main Social Security fund and making changes to the program. These cost-saving changes include allowing some recipients who can still work to receive partial payments while earning outside income and expanding a program requiring a second medical expert to weigh in on whether an applicant is truly disabled.

Conservatives in both chambers criticized the deal both because it was hatched behind closed doors rather than through the committee process and because they argued it is bad policy.

Many complained that the provisions in the bill that are used to offset the cost of the new spending are gimmicks or promise savings in the future for money the government will spend immediately.

“President Obama and Speaker Boehner are heading into retirement,” Sen. Ted Cruz (R-Texas) said in a statement earlier this week. “Some people get a gold watch. Obama and Boehner are settling for at least $80 billion in additional spending and debt above the budget caps. Unfortunately, our children and grandchildren will be left to foot the bill long after they are gone.”

Once the bill is signed into law, the Appropriations Committees will begin the process of writing an omnibus bill that will determine how the funds will be spent. That process is expected to take about a month and could be complicated if Republicans try to attach controversial provisions, like defunding Planned Parenthood, to the legislation.

Democrats have vowed to block any “poison-pill” riders, which could create another spending standoff in December.