House Democrats on Tuesday approved a roughly $3.5 trillion budget that could enable sweeping changes to the nation’s health-care, education and tax laws, overcoming their own internal divisions to take the next step toward enacting President Biden’s broader economic agenda.

The 220-to-212 party-line vote came after days of delays as House Speaker Nancy Pelosi (D-Calif.) scrambled to stave off a revolt from her party’s moderate-leaning lawmakers. With the frenzy resolved, the chamber averted what would have been a political embarrassment for the White House and its allies — even as the debacle foreshadowed much tougher fights among Democrats still on the horizon.

The outcome immediately set in motion a laborious effort on Capitol Hill to transform the $3.5 trillion blueprint into a fuller legislative product. Much like the proposal the Senate adopted this month, the House budget is essentially an outline that does not require Biden’s signature. Rather, it is a congressional document that unlocks for Democrats a longer legislative process known as reconciliation — a tactic that allows them to write a tax-and-spending bill that can bypass a Republican filibuster.

As part of the forthcoming package, Democrats have pledged to expand Medicare, invest sizable sums in education and family-focused programs, and devote new funds toward combating climate change — fulfilling many of the party’s 2020 campaign pledges. And they have aimed to finance the tranche of new spending through tax hikes targeting wealthy corporations, families and investors, rolling back tax cuts imposed under President Donald Trump.

“A national budget should be a statement of our national values,” Pelosi said before the House began voting. “And this will be the case.”

But the House approved its $3.5 trillion plan Tuesday only after a protracted debate that exposed the fractious and fragile nature of the Democratic caucus. Even Biden and his top aides had to intervene this week to break the stalemate within their party, illustrating the perils they may face in shepherding significant new spending along with tax increases to passage in the weeks ahead.

At the center of the recent battle were nine moderate lawmakers led by Rep. Josh Gottheimer (D-N.J.). The group for weeks had threatened to vote against the budget, arguing the House instead should have started its work on another of Biden’s priorities — a roughly $1.2 trillion bill to improve the nation’s infrastructure that passed the Senate last month.

Pelosi instead proceeded with her original plans to start with the spending blueprint, backed by her caucus’s liberal lawmakers, who previously had threatened to mobilize their nearly 100 members if the speaker took an alternate course. With both factions at odds, the standoff pushed Democrats to the brink, since Pelosi can afford to lose only three votes in the House — and has little room to alienate either influential bloc of lawmakers.

In the end, though, Democrats reached a compromise that allowed them to bring the matter to a vote — including a commitment that the House would consider the infrastructure proposal by Sept. 27. Gottheimer and his moderate allies hailed that deal as a victory, even as liberal lawmakers signaled initial unease with the arrangement, raising the specter that the fight is far from finished.

“The country has waited far too long for legislation that will actually fix our crumbling roads, bridges, tunnels, rail, and water, and invest in broadband and fighting climate change,” the nine centrist lawmakers said in a joint statement Tuesday. “This deal ensures the House will pass the bipartisan package by September 27th.”

The resolution for now prevented what would have been a major setback for Democrats’ economic ambitions and a fresh black eye for the Biden administration, which has absorbed political blows at a time when the pandemic is worsening and new troubles, such as the country’s imperiled exit from Afghanistan, are harming the president in the polls. It also averted a rare defeat for Pelosi, who has labored throughout her career as speaker to ensure Democratic divisions don’t result in losses on the House floor.

Speaking to reporters Tuesday, Biden hailed the development in the House as a critical milestone “toward making a historic investment that’s going to transform America, cut taxes for working families and position the American economy for long-term, long-term growth.”

“What is important is that we came together to advance our agenda,” he added.

Republicans, meanwhile, lined up unanimously against the budget in the House. Taking to the chamber floor before casting his vote against the proposal, Rep. Steve Scalise (R-La.), the House minority whip, alleged the spending Democrats envisioned would result in significant inflation and a severe worsening of the federal deficit.

“It really should be called the ‘Mountains of Debt For the Children Act’ because that’s what it does,” Scalise said.

House Speaker Nancy Pelosi (D-Calif) is facing down threats from the moderate wing of her party, as the House returns for a series of key votes. (Zach Purser Brown/The Washington Post)

The budget is a centerpiece of Biden’s economic agenda, opening the door for Democrats to pursue spending the president endorsed as part of the jobs and families plans he unveiled earlier this year. Along with expanding Medicare, these plans aim to lower prescription drug costs for millions of seniors and expand other federal safety net programs, including those that benefit low-income families. Democrats also seek to reform the country’s immigration system, ensure housing is more affordable and make it easier for Americans to obtain sick leave and child care.

The House vote followed weeks after the Senate adopted the same blueprint, chiefly written by Sen. Bernie Sanders (I-Vt.), the leader of the chamber’s budget committee. Sanders and other lawmakers have described the spending they have proposed as historic, likening it to the Great Society and New Deal programs that helped jump-start the U.S. economy.

Democrats across the Capitol broadly support the goals of the package. But serious schisms already separate the party’s liberal and moderate wings over how much to spend, and the extent to which they should finance it through tax increases. Those long-simmering tensions flashed almost immediately after the chamber approved its budget Tuesday, as Democrats sparred with each other over their next steps.

The roughly 100-member Congressional Progressive Caucus, which represents the House’s liberal members, has urged Biden and Democratic leaders in Congress to pursue as ambitious of an agenda as possible given Democrats’ slim but potent majorities in both chambers of Congress. In a sign of the haggling still to come, the bloc Tuesday fired a fresh warning shot: It praised the adoption of the budget, even as it reissued its threat to withhold its support on new public-works spending until the House approves a robust reconciliation bill.

“Our position remains unchanged: We will work to first pass the Build Back Better reconciliation bill so we can deliver these once-in-a-generation, popular and urgently needed investments to poor and working families, and then pass the infrastructure bill to invest in our roads, bridges and waterways,” said Rep. Pramila Jayapal (D-Wash.), chair of the caucus.

Moderates, however, exited the Tuesday vote believing they had successfully decoupled the two priorities, perhaps giving them additional flexibility to negotiate the scope of the final reconciliation package. Some centrist Democrats have been fearful about adding to the deficit — and skeptical about the size of the tax increases Biden has proposed.

In doing so, the nine centrists led by Gottheimer pointed to an additional commitment from Pelosi that she would not force the House to vote on a reconciliation package that had no chance to pass the Senate. Some House Democrats saw the move as another hedge against liberals, who face steep opposition in the chamber from moderates including Sens. Joe Manchin III (D-W.Va.) and Kyrsten Sinema (D-Ariz.), who already have signaled they won’t support a final proposal with a $3.5 trillion price tag.

“We want to see it done in a common-sense way that reflects the reality of what the Senate is willing to agree to, and what the House is willing to agree to, and we know that that’s different than some of the aspirational levers that some of our colleagues have,” said Rep. Jim Costa (D-Calif.), one of the nine who initially threatened to oppose the budget. “We’re not going to vote on a measure that doesn’t have 51 votes in the Senate.”