The six-bill package passed the House 241-190 Thursday night, and the short-term Homeland Security spending bill passed 239-192.
Mr. Trump says he won't accept any bill that doesn't include new money for border wall construction - though he's signaled he may be willing to come down from his $5 billion request.
After congratulating Pelosi for becoming Speaker of the House, President Trump insisted on the importance of a border wall.
I know they want to do that very badly, and so do I. So, hopefully, we're going to have a lot of things that we can get done together.
Pelosi, who was chosen speaker of the House with a majority of 220 votes, struck a conciliatory tone in her acceptance speech, referring to bipartisanship and a unifying spirit.
"We will call upon bold thinking to address the disparity of income in America, which is at the root of the crisis of confidence felt by so many Americans", Pelosi said. But that did not deter House Democrats.
Democrats also approved, 241-190, a separate measure funding the Agriculture, Interior and other departments through September 30.
Trump made the wall - a project estimated to cost about $23 billion - a key campaign promise in 2016, saying Mexico would pay for it and arguing it is needed to combat illegal immigration and drug trafficking.
"You can call it a barrier".
Thursday marked the first day of divided government in Washington since Trump took office in January 2017, as Democrats took control in the House from his fellow Republicans, who remain in charge of the Senate. "And I'm very proud of it", he said.
Trump confirmed that he privately told Democrats the shutdown could drag on for months or years, though he said he hoped it wouldn't last that long.
McConnell, who went back to the Capitol, unaware of the press conference, said it was encouraging that the White House officials and the congressional contingent would meet over the weekend "to see if they can reach an agreement and then punt it back to us for final sign off".
Talks are expected to resume on Friday.
"We're not doing a wall", Pelosi told reporters before the votes largely along party lines.
They will have that opportunity, as congressional panels will be led by chairmen who have pledged to probe topics such as Trump's income taxes, his firing of attorney general Jeff Sessions and the president's ties to Vladimir Putin.
Addressing reporters later, Trump confirmed his threat. Trump repeatedly said during his presidential campaign that Mexico would pay for the wall, but Mexico has refused and United States taxpayers likely will be left footing the bill.
It was the first time in USA history that a government shutdown has stretched from the end of one Congress to the beginning of the next.
She closed her remarks by remembering the late President George H.W. Bush and his work with the Americans with Disabilities Act, and she noted that Rep. Jim Langevin of Rhode Island, the first quadriplegic elected to Congress, will be the first Democrat to preside in the new Congress.