Washington (AFP) - President Donald Trump on Thursday boosted the chances of a US government shutdown when he savaged a "ridiculous" spending bill that lawmakers from both parties had hoped would avert a standoff.

"I want to know, where is the money for Border Security and the WALL in this ridiculous Spending Bill, and where will it come from after the Midterms?" Trump tweeted.

The president's remarks upended what congressional leaders thought would be a smooth process for approving a massive spending package before the current fiscal year ends on September 30, and in advance of November's midterm elections.

The bill, which easily passed the Senate 97-3 on Tuesday and heads to the House of Representatives, includes $674.4 billion in fiscal year 2019 defense funding, about $20 billion more than 2018, and funds other government departments including education, labor and health.

But other departments, including homeland security, would be funded on autopilot through December 7, postponing debate over funding a US-Mexico border wall as Republicans were eager to avoid a nasty fight over a top Trump priority until after the election.

Trump's comments, with just four legislative days before the end of the fiscal year, put a new wrinkle into the proceedings.

"Dems are obstructing Law Enforcement and Border Security. REPUBLICANS MUST FINALLY GET TOUGH!” he said.

Trump's threats may serve to rally his conservative base, whose voters are adamant that the president be provided sufficient funding to build a border wall.

But GOP leaders and rank-and-file members in Congress are concerned about highlighting the fight in the run up to midterm elections that are predicted to go well for Democrats.