US President Joe Biden has narrowly avoided a government shutdown, signing new legislation on spending just hours before the deadline. 

Republicans blocked the bill to fund the American government through to 3 December because they were unhappy with the plan to raise the debt ceiling, but it was eventually passed by the House and the Senate.

The House approved the measure in a bipartisan 254-175 vote, hours after it passed the Senate by 65-35.

Mr Biden quickly signed the measure behind closed doors before the funding was due to run out at midnight, the White House said.

“There’s so much more to do, but the passage of this bill reminds us that bipartisan work is possible and it gives us time to pass longer-term funding to keep our government running and delivering for the American people,” he said.

The government is now grappling with another bipartisan bill that would provide $1trn for infrastructure projects such as roads, railways and airports.

Negotiations stretched into the evening.

More on Joe Biden

In a statement to her Democratic colleagues, House Speaker Nancy Pelosi called it a “productive and crucial day” and said discussions continued.

Some progressive Democrats have vowed to vote against the bill, angry that Democrats have not yet reached agreement on a multitrillion-dollar companion bill with funding for social services and to address climate change.

Ms Pelosi confirmed the House would vote on Thursday on the infrastructure bill nonetheless.