WASHINGTON—For Democrats, it’s roughly $1 trillion down, about $2 trillion to go.

Even as Speaker Nancy Pelosi celebrated the House’s approval of a generational infusion of funding for roads, bridges, broadband and water systems on Friday, her mind was focused on the delicate negotiations within her caucus over the separate social-spending and climate bill she had hoped to pass the same day.

The...

WASHINGTON—For Democrats, it’s roughly $1 trillion down, about $2 trillion to go.

Even as Speaker Nancy Pelosi celebrated the House’s approval of a generational infusion of funding for roads, bridges, broadband and water systems on Friday, her mind was focused on the delicate negotiations within her caucus over the separate social-spending and climate bill she had hoped to pass the same day.

The California Democrat is leading the narrowest House majority in decades as she works to deliver key planks of President Biden’s agenda. On Friday, the House passed the bipartisan infrastructure bill, sending it to the White House. But Mrs. Pelosi settled for a procedural vote on the second bill, short of final passage, as she works to bring her members on board by later this month.

“Welcome to my world,” she told reporters on Friday evening. “This is the Democratic Party.”

Mrs. Pelosi has 221 members to 213 for the Republicans and can only lose three votes if all Republicans are opposed. She is navigating demands from centrist members facing tough re-election races, progressive members who see Democratic control of Washington as a time to be bold, and concerns from Black, Hispanic and Asian members about how the bills would affect minority communities.

Should the speaker succeed in bringing her caucus together to pass the social-spending bill, it is likely to be changed significantly in the Senate, and then return to the House where she will have to rally support again.

Friday marked a day of shifting plans for the speaker and some risky bets. While she had intended to hold final votes on both bills, that morning the votes were still not there to pass the education, healthcare, child care and climate package, according to people familiar with the count. All Republicans oppose that legislation, calling it wasteful and potentially damaging to the economy.

President Biden discussed a roughly $2 trillion social-spending and climate framework, calling the legislation “historic.” Progressives have said they would block the infrastructure bill without a deal on the social-policy and climate bill. The Wall Street Journal Interactive Edition

The main hurdle was a handful of centrist Democrats who had dug in against sending the bill to the Senate with no estimate from the Congressional Budget Office on how much the roughly $2 trillion package would actually cost or how much new revenue it would bring in. Party leaders have said the package is fully paid for, but centrists wary of further deficit spending said they wanted to see official numbers.

The eight or so centrist members were also still pushing for the infrastructure vote to be first, rather than the social-spending bill. All day Friday, lawmakers from different factions of the caucus went into Mrs. Pelosi’s office in the center of the Capitol.

“This is the most difficult thing that I can think of that she’s had to do, even more than the Affordable Care Act, because of the number of different angles that she’s had to solve,” said Daniel Weiss, Mrs. Pelosi’s former chief of staff.

Progressives had vowed to block the infrastructure vote as leverage until the social and climate bill moved, and had done so successfully twice, once in September and once last month, forcing embarrassing reversals from Mrs. Pelosi. She didn’t want a third.

As the day wore on, she announced in the afternoon that Democrats would vote on the infrastructure bill and then take a procedural vote on the social-spending bill, holding it for final passage until there was a CBO score. It was a suggestion offered by Majority Whip Jim Clyburn (D., S.C.) and members of the Congressional Black Caucus, who emerged as mediators.

Progressives fumed at the change and marched into a meeting room in the Capitol complex. Congressional Progressive Caucus Chair

Pramila Jayapal (D., Wash.) lamented that she was no longer at the negotiating table with the speaker, according to a person inside the room. At least 20 members appeared ready to vote against the infrastructure bill.

Mrs. Pelosi would need to win many of them over. She carried a list of names around the House floor, utilizing her “secret whip count,” she called it, and she was seen furiously texting and making calls. Late Friday, during a meeting of progressive lawmakers, Rep. Alan Lowenthal (D., Calif.) answered his phone, inadvertently set on speaker and blared to the hallway, that it was Mrs. Pelosi’s office trying to reach him.

After hours of huddling, calls from President Biden, a statement from moderates emerged saying they would back the social-spending bill should the CBO numbers match the White House estimates. Rep. Josh Gottheimer (D., N.J.), one of the centrist holdouts, and Ms. Jayapal gave a final statement of unity on the steps of the Capitol, a sign of all but the furthest left in the caucus coming on board. The bill passed 228 to 206, with the help of 13 Republicans, more than offsetting six Democratic defectors.

Related Video

Budget reconciliation may offer Democrats a way to sidestep some partisan gridlock and advance President Biden’s policy objectives. WSJ explains how the process works and why divisions in the party could scuttle the process. Photo Illustration: Carlos Waters / WSJ The Wall Street Journal Interactive Edition

“She took a risk and it worked, and it worked quite well,” said Rep. Emanuel Cleaver (D., Mo.). “I think people are going to be a bit more careful in their assessment of her, and I don’t think anybody wants to underestimate her.”

The first female speaker and the first person to lose and regain the gavel in more than 50 years, Mrs. Pelosi thrives on deal making. As a young girl, she watched her parents, Thomas and Nancy D’Alesandro, bring the various factions of Baltimore together, with her father as mayor and her mother hosting ravioli dinners.

To win the speakership in 2018, Mrs. Pelosi made a deal that she would serve only two more terms. She has declined to talk about if her retirement is impending, always refusing to entertain the question. The 81-year-old lawmaker who passed the Affordable Care Act in the Obama administration is setting her legacy in a time of narrow Democratic control.

By putting the caucus on record through a procedural vote on the social-spending bill, she has perhaps made the job of passing the bill easier. But Democrats will return from a weeklong recess with some still unsatisfied. And the CBO isn’t expected to release its full score on the bill for weeks, though lawmakers may be satisfied with some data, according to people familiar with their thinking.

“What’s going to be very important is to make sure the economic analysis matches expectations,” Mr. Gottheimer said.

Mrs. Pelosi already abandoned the idea of trying to negotiate a deal that all 50 members of the Democratic caucus, including Sens. Joe Manchin (D., W.Va.) and Kyrsten Sinema (D., Ariz.) were on board with. On Wednesday, with Democrats still reeling after a tough election night, she decided to put four weeks of paid family leave in the House bill, which Mr. Manchin has opposed. She also made further negotiated changes on prescription drugs and immigration that could also run into trouble in the Senate.

“There comes a point in time where we just have to let the legislative process work,” said Rep. Dan Kildee (D., Mich.), reflecting frustration with some centrist senators. The House Democrats couldn’t continue to “put ourselves in a position where someone who won’t speak clearly about what he will vote for continues to you know, move the goal line.”

Write to Natalie Andrews at Natalie.Andrews@wsj.com