The House voted 217-185, largely along party lines. The bill now goes to the Senate, where it has almost no chance of passing.
Senators already passed their bill to avert a shutdown by extending funds to Feb. 8. It did not include the wall funding.
Without resolution, government funding for various departments expires at midnight Friday.
Trump had given mixed signals on how hard he would push for $5 billion in border wall funds. But he dug in Thursday, telling House Republican leaders he wouldn't sign the Senate bill that didn't have the money.
President Donald Trump will not travel to Florida on Friday for Christmas if the government is headed toward a partial shutdown.
That's the word late Thursday from two of Trump's senior advisers.
Press secretary Sarah Huckabee Sanders told reporters at the White House that Trump "will not travel in a shutdown."
Policy adviser Stephen Miller also says Trump will stay at the White House absent an agreement with Congress to keep parts of the government open.
Trump told House Republican leaders earlier Thursday that he will not sign Senate-passed legislation to keep parts of the government operating through early February because the measure does not include $5 billion he has demanded to pay for a wall he promised to build on the border with Mexico.
The Republican-led House has voted to add $5 billion for a border wall with Mexico to a bill preventing a partial federal shutdown this weekend.
Thursday's House vote was a party line 221-179.
The next vote will be on whether the House will approve the overall bill. That is expected to be close.
The Senate late Wednesday approved a bipartisan compromise keeping government agencies open until Feb. 8. That measure had no wall money.
President Donald Trump said Thursday he would veto that bill and demanded wall money.
Even if the House approves the measure with the wall funds, it faces certain rejection in the closely divided Senate, where Democrats solidly oppose the wall.
Scores of federal agencies will close after midnight Friday night unless Congress passes legislation preventing that.
President Donald Trump is defending his decision to risk a partial government shutdown as he demands money for his long-promised border wall with Mexico.
Trump says a "powerful physical barrier" is "essential to border security" and that "every nation has not only the right, but the absolute duty to protect its borders."
The president commented during a farm bill signing ceremony.
Earlier Thursday, he told congressional Republicans he wouldn't support a short-term spending measure passed by the Senate the night before. The government will partially shut down at midnight Friday unless there's a deal.
Trump says he's made his position "very clear" and that the package must include money for border security.
But he says he's willing to accept a steel slat barrier instead of the continuous concrete wall that was the central promise of his 2016 campaign.
House Republicans are making a last-ditch attempt to add $5 billion for President Trump's border wall with Mexico to a government funding bill.
The third-ranking House Republican says the GOP majority will try to add that money along with disaster aid for hurricane and wildfire victims.
It's unclear whether the bill can pass the House. Asked what happens if the vote fails, Louisiana Rep. Steve Scalise (skuh-LEES') says: "That's a negative attitude."
A partial government shutdown will begin at midnight on Friday unless the impasse is resolved.
House Majority Leader Kevin McCarthy is playing down the possibility of a shutdown. The California Republican says: "I think you'll find that we'll be able to move forward."
The Senate passed a short-term spending bill without the wall money on Wednesday evening. Trump has told Republicans he won't sign it.
President Donald Trump has told congressional Republicans he "will not sign" a spending bill passed by the Senate to avoid a partial government shutdown Friday, and he's citing an impasse over money for a border wall with Mexico.
House Speaker Paul Ryan says after leaving a meeting with Trump at the White House that he and other leaders are going to go back to Capitol Hill to "work on adding border security" to the legislation.
Trump is facing a backlash from conservative supporters who've urging to him to stick with an earlier pledge to force a shutdown in hopes of securing money for his long-promised border wall.
The wall was the top promise of his presidential campaign.
Senate Democratic leader Chuck Schumer is urging President Donald Trump to ignore the advice of the conservative House Freedom Caucus, which is encouraging Trump to veto a stopgap spending bill that averts a looming partial government shutdown.
Conservatives oppose the bill because it doesn't include billions of dollars for Trump's long-promised border wall with Mexico — a central plank of Trump's 2016 presidential campaign.
Schumer says in a Senate speech that Freedom Caucus leaders have "no strategy at all" beyond shutting down the government.
And Schumer, in his own words, says a "Trump shutdown will not convince a single Democrat to support bilking the American taxpayer for an ineffective, unnecessary and exorbitantly expensive wall."
Trump has promised Mexico will pay for the wall, a claim Mexico rejects.
The White House says President Donald Trump is meeting with Republican House members at noon Thursday as the fate of legislation to avoid a government shutdown hangs in the balance.
At issue is the president's demand for billions of dollars for his long-promised wall along the U.S.-Mexico border.
Press secretary Sarah Huckabee Sanders says that "at this moment, the president does not want to go further" on a proposed budget deal "without border security, which includes steel slats or a wall."
She says Trump is continuing to consider his options.
If there's no deal, there could be a partial shutdown at the end of Friday.
Trump already has lashed out at GOP leaders in Congress over the lack of wall funding in a short-term spending bill that passed the Senate on Wednesday. Trump's come under criticism from conservative supporters over the issue.
GOP leaders canceled a morning news conference as rank-and-file lawmakers indicated opposition to the stopgap spending measure.
President Donald Trump is attacking Republican leaders in Congress, saying they haven't kept promises that he would get money for his long-promised border wall by year's end.
Trump says in a tweet that when he "begrudgingly" signed an earlier spending bill, he was "promised the Wall and Border Security by leadership. Would be done by end of year (NOW). It didn't happen!"
Congress is now trying to pass legislation that would avoid a partial government shutdown. While Trump has backed off a shutdown threat, he's coming under pressure from conservative allies to veto a short-term deal.
Trump spoke with House Speaker Paul Ryan on Thursday. One Republican says Ryan left a morning meeting of House Republicans to take a phone call from Trump. This Republican who wasn't authorized to speak publicly about the call and discussed it on condition of anonymity didn't know what was said.
—Associated Press writer Alan Fram.
The question of averting a partial shutdown of the federal government has moved from the Senate to the House.
Senators late Wednesday approved by voice vote a measure that keeps the government funded to Feb. 8. The House is expected to vote on the measure before the midnight Friday deadline.
The measure doesn't include the money President Donald Trump has demanded for his proposed border wall with Mexico.
Trump still must sign a funding bill into law to avert a shutdown of some government agencies. While the White House has indicated that Trump is open to reviewing whatever Congress passes, the president hasn't weighed in on the stopgap measure.
Many Trump supporters are frustrated that he appears to have retreated on his shutdown threats over wall funding.