Donald Trump will sign the government funding bill. (File Photo)

President Donald Trump will sign a border security bill to avert another government shutdown, but also declare a national emergency to try to obtain funds for his promised US-Mexico border wall, a White House spokeswoman said on Thursday.

In an attempt to bypass Congress to get money that lawmakers have so far denied him for his wall along the U.S.-Mexico border, Trump appeared headed toward triggering a swift court challenge from Democrats on constitutional grounds.

The top Democrat in Congress immediately denounced the president's move. Asked by reporters whether she would file a legal challenge to the emergency declaration, House of Representatives Speaker Nancy Pelosi said, "I may, that's an option."

"President Trump will sign the government funding bill, and as he has stated before, he will also take other executive action - including a national emergency - to ensure we stop the national security and humanitarian crisis at the border," White House spokeswoman Sarah Sanders said.

"The president is once again delivering on his promise to build the wall, protect the border, and secure our great country," she said in a statement.

The bipartisan compromise federal spending legislation expected to arrive soon on Trump's desk after being voted on in the Republican-led Senate and Democratic-led House would provide more than $300 billion to fund the Department of Homeland Security and a range of other agencies through Sept. 30, the end of the current fiscal year.

Funding for those agencies is due to expire on Friday, which would trigger another partial federal shutdown on Saturday morning if Congress and Trump do not act quickly.

A source familiar with the situation said that the White House had identified $2.7 billion in funds previously provided by Congress that could be redirected to barrier funding as part of a national emergency.

The source said White House lawyers had vetted the figures and believed they would withstand a legal challenge. Under the Constitution, Congress holds the national purse strings and makes major decisions on spending taxpayer money.

The Trump administration has suggested that it could use national emergency powers to redirect money already committed by Congress for other purposes toward paying for Trump's wall.

Pelosi accused Trump of doing "an end-run" around Congress and around the Constitution's separation of powers that gives Congress, not the president, such authority as federal spending and declaring war.

"It's not an emergency, what's happening at the border. It's a humanitarian challenge to us," Pelosi said.

"If the president can declare an emergency on something that he has created as an emergency - an illusion that he wants to convey - just think of what a president with different values can present to the American people," Pelosi added, pointing to gun violence in the United States as a national emergency.

Congress was expected later on Thursday to approve the bill, which does not contain the money Trump demanded for the wall, but does contain money for other border security measures.

Trump triggered a 35-day-long shutdown of about a quarter of the federal government with his December demand for $5.7 billion to help build a portion of the wall.

In denying him that money, Congress has blocked Trump from carrying through on one of his key 2016 campaign pledges.

The border bill would provide $1.37 billion in new money to help build 55 miles (88.5 km) of new physical barriers on the border. It is the same level of funding Congress appropriated for border security measures last year, including barriers but not concrete walls.

Earlier, top Senate Democrat Chuck Schumer called the spending legislation agreement a "reasonable compromise."

"It does not fund the president's wall, but it does support smart border security initiatives that both parties have always supported ... Most importantly, it will keep our government open," Schumer said on the Senate floor.

The legislation would also fund the Justice Department, Commerce Department, State Department, Department of Agriculture, Internal Revenue Service and others, covering roughly 800,000 federal workers.

Failure to enact the bill would shutter many programs, from national parks maintenance and air traffic controller training programs to the collection and publication of important data for financial markets, for the second time this year.