The US has averted a government shutdown after the Senate passed a Republican-led measure to keep the government funded for the next six months.

The stopgap funding bill passed in the Senate 54-46, as two Democrats joined all but one Republican senator in voting yes. President Donald Trump had signed it into law, a White House spokesman said on Saturday.

The key vote came earlier when some Senate Democrats, after fierce debate, allowed the measure to pass a procedural hurdle.

The Senate minority leader, Democrat Chuck Schumer, and nine others broke with their colleagues to vote to advance the bill to its final Friday evening vote.