The U.S. House of Representatives on Wednesday night passed a bill to suspend the government's borrowing limit for two years, with wide support from both sides of the aisle, just days before a potential first-ever default on the national debt.

The House, narrowly controlled by Republicans, voted 314-117 to send the bill to the Senate before President Joe Biden can sign it into law.

Soon after the legislation cleared the major hurdle despite strong opposition from far-right Republican members, the Democratic president released a statement hailing the House for taking a "critical step" forward to avoid an unprecedented default.

Photo taken May 30, 2023, shows the U.S. Capitol in Washington. (Kyodo)

"I have been clear that the only path forward is a bipartisan compromise that can earn the support of both parties. This agreement meets that test," he said. "I urge the Senate to pass it as quickly as possible so that I can sign it into law, and our country can continue building the strongest economy in the world."

The passage came after weeks of tense negotiations between Biden and House Speaker Kevin McCarthy. The two finally struck a deal over the weekend to suspend the $31.4 trillion cap through Jan. 1, 2025, paving the way for the federal government to continue borrowing money and issuing payments on time.

The Treasury Department has warned the United States is set to default next Monday unless both chambers of Congress pass the legislation. Democrats hold sway in the upper chamber.

"Tonight, we all made history because this is the biggest cut and savings this Congress has ever voted for," McCarthy told reporters, thanking his fellow Republicans for providing the required support.

In the House vote, 165 Democrats and 149 Republicans supported the 99-page bill, while 46 Democrats and 71 Republicans opposed it.

The bipartisan plan brokered by Biden and McCarthy takes the risk of default off the table until after the November 2024 presidential election. The deal also effectively caps nondefense spending for the same two-year period and increases work requirements for some people receiving food aid benefits, as demanded by Republicans.

Under the plan, budget deficits would be cut by $1.5 trillion over the next 10 years, according to an estimate released Tuesday by the Congressional Budget Office.

The hard-line conservative Freedom Caucus has attacked McCarthy, saying the spending cuts are not deep enough, while Biden has drawn criticism from progressive members of his party who believe the president gave in too easily to Republican demands.

Related coverage:

Biden strikes deal "in principle" with Republicans to avert default

Yellen warns deal on debt ceiling must be struck by June 5