WASHINGTON — Congress sent President Trump a $4.6 billion humanitarian aid package on Thursday after Speaker Nancy Pelosi capitulated to Republicans and Democratic moderates and dropped her insistence on stronger protections for migrant children in overcrowded border shelters.

The vote came after a striking display of Democratic disunity and was a setback for Ms. Pelosi. Until Thursday, she had proved adept at navigating the complexities of a caucus rived by powerful progressive and moderate factions that often work at cross purposes. But their priorities clashed, the liberal flank was vanquished and the speaker — who had put her reputation on the line, calling herself a “lioness” out to protect children as she held out for stronger protections in the migrant facilities that house them — grudgingly had to accept defeat.

The final vote, 305 to 102, included far more Republicans in favor, 176, than Democrats, 129. It left House liberals furious.

“In order to get resources to the children fastest, we will reluctantly pass the Senate bill,” Ms. Pelosi said in a letter to Democratic lawmakers. “As we pass the Senate bill, we will do so with a battle cry as to how we go forward to protect children in a way that truly honors their dignity and worth.”