The US House of Representatives has passed a spending bill, including money for the president’s border wall, to keep US agencies open until February.
The measure now heads to the Senate, where it is expected to fail, setting the stage for a partial government shutdown on Friday at midnight.
Mr Trump had said he refused to sign a short-term funding bill that did not include money for his US-Mexico wall.
The proposed southern barrier was one of Mr Trump’s key campaign pledges.
The lower chamber on Thursday night approved the government spending bill in a 217-185 vote, which included Mr Trump’s request for $5bn (£4bn) for his promised border wall with Mexico.
The measure passed hours after House Speaker Paul Ryan and other Republican leaders met Mr Trump on Thursday afternoon to discuss budget negotiations.
The Senate had unanimously passed a spending measure on Wednesday night to keep the government running until 8 February ahead of Friday’s deadline.
But the bill did not include border wall money, and the Republican president on Thursday insisted he would not sign any bill that did not contain wall funding, Mr Ryan told reporters after the meeting.
“I’ve made my position very clear: any measure that funds the government must include border security,” the president said at a farm bill signing event later on Thursday.
The House version includes $5.7bn for the US-Mexico barrier and $7.8bn for disaster funding.
But the bill is expected to fail in the Senate, where Democrats could block the 60-vote majority needed to approve it. Although Republicans control the Senate, Mr Trump’s party only has 51 seats.
If Congress is unable to agree upon a temporary funding bill by Friday night, funding will expire for agencies that control federal law enforcement agencies, airport security, space exploration and farm programmes.
“The bill that’s on the floor of the House, everyone knows will not pass the Senate,” Democratic Leader Chuck Schumer said just before the vote.
Fears of a government shutdown over the wall set markets on edge on Thursday, when the Dow fell by 2% – over 400 points – to a 14-month low.
Mr Trump’s supporters had earlier accused him of caving on his promised wall, including members of the ultra-conservative House of Representatives Freedom Caucus as well right-wing media outlets Brietbart News and The Drudge Report.
Meanwhile, some Trump supporters have decided to take matters into their own hands, launching a $1bn online fundraiser for the wall.
The GoFundMe has amassed more than $9m in three days.
Brian Kolfage, the Iraq War veteran behind the campaign, said raising the money was achievable if every Trump voter pledged $80.
“This won’t be easy, but it’s our duty as citizens,” Mr Kolfage said. “We can help President Trump make America safe again!”
The president had planned to begin a two-week holiday at his Mar-a-Lago resort in Florida, but will remain at the White House should a partial government shutdown happen.