The measure passed the House 235-193, mostly along party lines, and breezed through the Senate on a sweeping 81-14 tally barely an hour later. It would keep the government running through Dec. 22, when another, and more difficult, shutdown problem awaits.
The bill now heads to Trump for his signature.
Topics at the White House session included relief from a budget freeze on the Pentagon and domestic agencies, extending a key children's health program and aid to hurricane-slammed Puerto Rico, Texas and Florida. The trickiest topic, and a top priority for Democrats, involves protections for immigrants brought to the country illegally as children.
These "Dreamer" immigrants are viewed sympathetically by the public and most lawmakers but face deportation in a few months because Trump reversed administrative protections provided to them by former President Barack Obama.
In back-to-back statements, both Democratic and GOP leaders declared the meeting "productive." The White House called it "constructive." Privately, congressional aides said little progress had been made.
"We had a productive conversation on a wide variety of issues. Nothing specific has been agreed to, but discussions continue," said Capitol Hill's top Democrats, Sen. Chuck Schumer of New York and Rep. Nancy Pelosi of California, ticking off a roster of Democratic priorities, including domestic spending increases, funding for veterans and money to battle opioid abuse, immigration and health care.
GOP leaders said they agreed with the need to address immigration, including the almost 1 million immigrants given protections by Obama, many of whom have only known America as their home.
Spokesmen for House Speaker Paul Ryan, R-Wis., and Senate Majority Leader Mitch McConnell, R-Ky., said GOP leaders "stressed the need to address border security, interior enforcement and other parts of our broken immigration system," adding that the tricky immigration issue "should be a separate process and not used to hold hostage funding for our men and women in uniform."
Negotiations are sure to be challenging. Pelosi staked out a hard line Thursday and insisted that any year-end deal solve the immigration issue.
Pelosi told reporters before the meeting that "we will not leave here" without helping the "Dreamers." Her stance was noteworthy because GOP leaders are likely to require Democratic votes for the pre-Christmas spending bill.
The White House said "negotiations on immigration should be held separately on a different track" and not slow down funding increases for the Pentagon.
Pelosi returned from the White House to oppose Thursday's stopgap bill. Fourteen Democrats supported the measure, however, while 18 Republicans opposed it.
Among Republicans, the conservative House Freedom Caucus had resisted the pending stopgap measure earlier in the week, fearing it would lead to a bad deal for conservatives down the road. But on Thursday, the group's chairman, Rep. Mark Meadows, R-N.C., said the group will likely give leaders whatever support they need to pass the legislation.
Meadows said they'd help it pass to avoid distractions from the GOP drive to push their treasured $1.5 trillion tax bill through Congress this month. That measure, which mostly benefits businesses and upper-income people, is Trump's and the GOP's top remaining priority and would be their first major legislative triumph of the year.
But hours before Trump was to bargain with congressional leaders at the White House over longer-term spending decisions, Meadows said the conservatives would oppose any agreement they feel allows excessive federal spending.
"I want to avoid a headline that says President Trump's administration just passes the highest spending levels in U.S. history," Meadows told reporters. "There will be zero support on numbers that are too high, regardless of anybody's position on that."
He also said Ryan promised he'd fight in coming weeks to pass a full-year budget for the military and leave fights with Democrats over domestic spending for later. It is unclear how that strategy would work, since Republicans control the Senate 52-48 and will need at least eight Democratic votes to pass any spending legislation.
The prospects for successful White House talks were buffeted Wednesday when the impulsive Trump blurted to reporters that a shutdown "could happen." He blamed Democrats, saying they want "illegal immigrants pouring into our country, bringing with them crime, tremendous amounts of crime."
Last week, an unexpected attack by Trump on Schumer and Pelosi prompted the two to skip a bargaining session.
The two-week spending bill also makes money available to several states that are running out of funds for the Children's Health Insurance Program, known as CHIP. That widely popular program provides medical care to more than 8 million children.
The CHIP issue is among the year-end items where negotiations have gone positively, and aides say a long-term agreement is nearly in hand.
Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.