A bipartisan coalition was set to push through the compromise struck by Speaker Kevin McCarthy and President Biden, even as lawmakers in both parties signaled their displeasure with the plan.The House on Wednesday was poised to push through legislation negotiated by President Biden and Speaker Kevin McCarthy to suspend the debt ceiling and set federal spending limits, as a bipartisan coalition lined up to cast a critical vote to pull the nation back from the brink of economic catastrophe.The bill would defer the federal debt limit for two years — allowing the government to borrow unlimited sums as necessary to pay its obligations — while imposing two years of spending caps and a string of policy changes that Republicans demanded in exchange for allowing the country to avoid a disastrous default. The vote, expected Wednesday night, was coming days before the nation was projected to exhaust its borrowing power, and after a marathon set of talks between White House negotiators and top House Republicans.With both far-right and hard-left lawmakers in revolt over the deal, congressional leaders cobbled together a coalition of Republicans and Democrats willing to drag the bill over the finish line, throwing their support behind the compromise in an effort to break the fiscal stalemate that has gripped Washington for weeks.It nearly collapsed on its way to the House floor, when hard-right Republicans sought to block its consideration, and in a suspenseful scene, Democrats waited several minutes before swooping in to supply their votes for a procedural measure that allowed the plan to move ahead.Representative Dan Bishop of North Carolina, along with other hard-right House Freedom Caucus members, tried to block the procedure to advance the debt deal to a vote on Wednesday.Haiyun Jiang for The New York TimesThe deal would suspend the $31.4 trillion borrowing limit until January 2025. It would cut federal spending by $1.5 trillion over a decade, according to the Congressional Budget Office, by effectively freezing some funding that had been projected to increase next year and then limiting spending to 1 percent growth in 2025, which is considered a cut because it would be at a lower level than inflation. The legislation would also impose stricter work requirements for food stamps, claw back some funding for I.R.S. enforcement and unspent coronavirus relief money, speed the permitting of new energy projects and officially end Mr. Biden’s student loan repayment freeze.The compromise was structured with the aim of enticing votes from both parties, allowing Republicans to say that they succeeded in reducing some federal spending — even as funding for the military and veterans’ programs would continue to grow — while allowing Democrats to say they spared most domestic programs from significant cuts.Ahead of the series of votes on Wednesday, Mr. McCarthy urged his members to support the bill, framing it as a “small step putting us on the right track,” and promoting the spending cuts and work requirements Republicans won in the deal.“Everybody has a right to their own opinion,” he said. “But on history, I’d want to be here with this bill today.”In the Senate, both Democratic and Republican leaders said they would quickly take up the legislation and push to get the package to Mr. Biden as swiftly as possible, with Senator Chuck Schumer, Democrat of New York and the majority leader, warning that lawmakers would need to approve the bill without changes to meet the June 5 deadline when the Treasury Secretary Janet L. Yellen has said the government would default without action by Congress.“I cannot stress enough that we have no margin for error,” Mr. Schumer said. “Either we proceed quickly and send this bipartisan agreement to the president’s desk or the federal government will default for the first time ever.”Senator Chuck Schumer, Democrat of New York and the majority leader, warned that lawmakers would need to approve the bill without changes to meet a June 5 deadline to avert a default.Haiyun Jiang for The New York TimesPassage of the deal would be a major victory for Mr. McCarthy, a California Republican who faced a massive challenge in shepherding a debt-ceiling increase through a narrowly divided chamber populated by Republicans who have long refused to raise the borrowing limit. Few had expected that Mr. McCarthy would be able to unite his fractious conference around any such measure, much less one negotiated with Mr. Biden, without prompting an attempt by his right flank to oust him.As of Wednesday, no such effort had materialized, thought there still may be political consequences ahead for Mr. McCarthy. Representative Dan Bishop, Republican of North Carolina and a member of the ultraconservative Freedom Caucus, has publicly said that he considered the debt and spending deal grounds for removing Mr. McCarthy from his post. Another member of the group, Representative Ken Buck, Republican of Colorado, told CNN that its members would have “discussions about whether” to try to oust him.“I’m not suggesting the votes are there to remove the speaker, but the speaker promised that we would operate at 2022 appropriations levels when he got the support to be speaker,” Mr. Buck said. “He’s now changed that to 2023 levels plus one percent. That’s a major change for a lot of people.”Under the rules House Republicans adopted at the beginning of the year that helped Mr. McCarthy become speaker, any single lawmaker could call for a snap vote to depose him, a move that would require a majority of the House.Hard-right lawmakers were nonetheless furious over the compromise, savaging the bill and Mr. McCarthy’s handling of the negotiations as a betrayal.“No one sent us here to borrow an additional $4 trillion to get absolutely nothing in return,” said Representative Chip Roy, Republican of Texas, who promised “a reckoning about what just occurred.”In a dramatic display of their displeasure, 29 conservative Republicans took the unusual step of breaking ranks on a procedural vote to take up the legislation, normally a formality that passes entirely along party lines.In a dramatic tableau on the House floor, as the Republican defections piled up, imperiling the deal, Representative Hakeem Jeffries of New York, the minority leader, finally raised a green voting card in the air, signaling to fellow Democrats that it was time go ahead and bail Republicans out. A stream of centrist and veteran lawmakers — 52 in all — crowded into the well of the House and voted “yes,” rescuing the deal from collapse.After a pause on the floor when Republicans came up short on votes, Representative Hakeem Jeffries, the New York Democrat and minority leader, gave the assent to a group of Democrats to help move toward a vote on the deal.Kenny Holston/The New York TimesMr. Jeffries had gathered Democrats in the Capitol on Wednesday morning, along with top White House officials who had helped broker the deal, and urged them to back the compromise. He argued that Mr. Biden had successfully fended off the worst of Republicans’ demands, and reiterated that allowing the nation to default was not an option.“I made clear that I’m going to support legislation that is on the floor today,” Mr. Jeffries told reporters at a news conference after the meeting. “And I support it without hesitation or reservation or trepidation.”But progressive Democratics bristled at the package, and said they could not support new work requirements for safety net programs or incentivize Republicans from weaponizing the debt ceiling as a political cudgel.“Republicans need to own this vote,” said Representative Alexandria Ocasio-Cortez, Democrat of New York, who took particular aim at changes to the Supplemental Nutrition Assistance Program and a measure to expedite production of a gas pipeline. “This was their deal, this was their negotiations. They’re the ones trying to come in and cut SNAP, cut environmental protections, trying to ram through an oil pipeline through a community that does not want it.”“Republicans need to own this vote,” said Representative Alexandria Ocasio-Cortez, Democrat of New York, one of a group of Democrats displeased with Republican provisions in the bill.Kenny Holston/The New York Times“This has been a hostage situation,” Representative Greg Casar, Democrat of Texas, said. “We’re going to get out of the hostage situation. I appreciate the president negotiating down the ransom payment for the hostage. But I think it’s appropriate for progressives to say we never want to be in this situation again.”Adding to progressive discontent are provisions in the deal that claw back some unspent money from a previous pandemic relief bill, and reduce by $10 billion — to $70 billion from $80 billion — new enforcement funding for the I.R.S. to crack down on tax cheats. Other measures in the bill include a provision meant to speed the permitting of certain energy projects and a provision meant to force the president to find budget savings to offset the costs of a unilateral action, like forgiving student loans — though administration officials could circumvent that requirement.The deal also includes measures meant to avert a government shutdown later this year.Carl Hulse More