The US House of Representatives has passed a bill to send $4.6bn (£3.6bn) in aid to tackle the humanitarian migrant crisis at the Mexico border.
House Democrats had originally wanted to pass a stricter bill with extra protections for migrant children, but the Senate voted it down.
The aid plan comes amid outrage over US detention conditions and an image showing a drowned father and daughter.
The House Speaker told Democrats to "reluctantly" approve the Senate plan.
"The children come first. At the end of the day, we have to make sure that the resources needed to protect the children are available," Nancy Pelosi said in a letter to colleagues.
The bill passed with 305 votes to 102 on Thursday, amid pressure to approve a plan before the 4 July recess.
President Trump, who is in Japan for a G20 summit and now has to sign the bill into law, gave the result a thumbs-up.
Bipartisan Humanitarian Aid Bill for the Southern Border just passed. A great job done by all! Now we must work to get rid of the Loopholes and fix Asylum. Thank you also to Mexico for the work being done on helping with Illegal Immigration - a very big difference!— Donald J. Trump (@realDonaldTrump) June 27, 2019
How did the bill pass?
The Democrat reversal came after a showdown over rival congressional plans.
Mrs Pelosi had maintained the Democratic-controlled House would not concede to the Senate, where Republicans have a majority. But she changed tack on Thursday.
The New York Times described the concession as a "striking defeat" for Mrs Pelosi, who was reportedly facing pressure from moderates within her own party.
She is reported to have spoken with Vice-President Mike Pence before the vote. US media say he offered administrative assurances to Mrs Pelosi regarding child migrants - including prompt reporting of deaths in custody.
Some Democrats had said they could not trust the Trump administration with billions of dollars in aid funds. They wanted to push for specific rules on detention conditions and on how the funding could be used.
The House version of the bill, with these protections, was voted down in the Senate by a 55-37 majority - with three Democratic Senators joining Republicans in voting against it.
The Congressional Hispanic Caucus had recommended voting against the Senate's version of the bill.
After it passed, they said the approval represented a "betrayal of our American values" that would fail to stop "chaos and cruelty".
"As a result, migrants will continue to die," their statement said.
What's been happening at the border?
The congressional showdown follows an outcry over conditions at the border.
Several bodies, including those of babies and children, were discovered in recent days, as some migrants opted to try and cross into the US illegally.
A photograph of a father and his daughter lying face down in the Rio Grande river has also shocked many. In the photograph, two-year-old Valeria has an arm wrapped around her father, Óscar Alberto Martínez Ramírez, as both lie dead close to shore.
It came shortly after it emerged some migrant children were being held at detention facilities in "horrific" conditions - including without soap or toothbrushes.
Why is there a crisis about the border?
Mr Trump has made curbing illegal immigration a policy priority since his election.
His "zero tolerance" policy was announced in early 2018. By prosecuting adults who crossed the border illegally, it had the effect of separating children from their parents.
Despite a court order requiring families to be reunited and an end to separations last year, hundreds remain in government shelters, to which the public - including journalists and rights activists - had little access.
Lawyers were recently given access to one facility in Clint, Texas, by a judge. They reported appalling conditions inside, in which children under 10 were caring for infants, and massive overcrowding.
Children were "locked up in horrific cells where there's an open toilet in the middle of the room" where they ate and slept, one of the lawyers told the BBC.