SPRINGFIELD — It took several hours, three roll-call votes and no shortage of drama, but the Illinois House on Monday passed a “compromise” school funding bill — setting the stage for state government to overhaul the way it bankrolls public education.

The measure, which initially failed, cleared the chamber 73-34. The Senate on Tuesday plans to take up the bill — which Republican Gov. Bruce Rauner has said he’ll sign.

“Everybody wins in this conversation,” bill sponsor State Rep. Will Davis, D-Homewood, said before the passage. Illinois House Republican Leader Jim Durkin, R-Western Springs, said the compromise “ensures for the first time in decades that all children in Illinois will have access to education that is funded fairly and equitably.”

Durkin also said the deal shows what can happen when political “bickering” is set aside for a larger goal.

The compromise is thought to be a historic step forward for public school funding statewide. It was reached after weeks of negotiations — and was struck as a way to get both Republicans and Rauner on board.

The House failed to pass the compromise measure on the first try — only 14 Democrats voted for it — but that was a largely ceremonial act orchestrated by Democrats to show their disdain of one of the bill’s most controversial aspects: a $75 million private school scholarship and tax-credit program that teachers unions oppose.

Then, House Speaker Michael J. Madigan, D-Chicago, called for an override vote on Rauner’s changes to a Senate education-funding bill — a measure that failed when Republicans refused to go along. That, too, was done to appease many Democrats who for weeks had been advocating for the override.

That set the stage for a successful vote to re-call the compromise bill. This time, it passed — and Rauner took the House floor to shake hands, with both Republican and Democratic lawmakers.

“Instead of pitting children and communities against each other, Democrats and Republicans came to an agreement on much of what’s in this bill,” Madigan said in a statement after the vote. “And even where we don’t fully agree, we’re willing to work together in good faith and meet each other half way. . . . Every district in Illinois wins under this plan.”

Rauner in a statement thanked the leaders for “finding common ground that will reverse the inequities of our current school funding system.”

The legislation is intended to put new money for education into the state’s poorest and neediest districts — and to try to ease the state’s reliance on local property taxes to pay for schools. The system has enabled wealthier communities to pump more money into public education while poor districts fall further behind.

But the compromise includes the controversial private school scholarship and tax-credit program that critics have dubbed “vouchers.” The tax credits are opposed by powerful teacher unions, including the Chicago Teachers Union and the Illinois Federation of Teachers, that traditionally have supported Democrats.

The tax-credit program was backed by Rauner, Republicans and Cardinal Blase Cupich of the Archdiocese of Chicago. It would provide tax credits for anyone who donates to organizations that would create scholarship funds for low- and mid-income students attending private schools.

At least for the next five years — when the measure will sunset — donors would get a credit for 75 cents on every dollar they give. Democrats estimated the program would provide scholarships for up to 6,000 students.

State Rep. Mary Flowers, D-Chicago, voted “no” twice because she said the private school program warranted public meetings that didn’t take place. “To me, this issue is too important,” she said.

Rep. Will Guzzardi, D-Chicago, also voted against the measure — saying it was “unconscionable” to vote in support of the private school program.

“As far as I’m concerned the nose is under the camel’s tent now, and I’m very concerned about the prospect of this money only growing, and more and more over the years of our public dollars being diverted away,” Guzzardi said, adding he’s worried there will be an expansion instead of a sunset in five years.

“Eventually hundreds of millions of dollars of our public money is going to be diverted away to give tax breaks to very wealthy people and big businesses who are contributing to private school scholarships and that’s wrong to me,” Guzzardi said.

The lengthy bill, totaling about 550 pages, also includes a hold-harmless provision to ensure schools don’t lose money.

State Rep. David McSweeney, R-Barrington Hills, was among the Republicans not on board with the measure both times, namely because of the inclusion of the potential bump in the property-tax levy for Chicago. The measure includes language that would allow the Chicago City Council to raise the city’s property tax levy to bring in $120 million more in new tax dollars to pay for Chicago Public Schools pensions.

But Chicago Ald. Pat O’Connor (40th) said the Chicago Board of Education would enact such a tax hike only as a last resort, as city homeowners and businesses are “pretty much at critical mass” after being hit with $838 million in property-tax increases to cover a wide range of city-related pension payments.

“Good business would require you to look at all other options before you go further into debt. It’s a last-case scenario,” he said.

Earlier Monday, Chicago school board President Frank Clark said he supported the bill, saying the benefit to CPS vastly outweighs the tax credit benefiting private schools. And CPS’ take from the compromise bill could total $450 million, Clark said.

For the third year in a row, CPS is depending on promised state funding to try to balance the budget that its board passed Monday afternoon. Clark said he supports the details he’s heard about the compromise legislation, which includes the tax-credit program.

“I cannot in my own mind balance $75 million against the $450 million that CPS would benefit from, whether I agree or disagree with” the program, Clark said. Protesting that part “puts the whole deal in jeopardy.”

Mayor Rahm Emanuel on Monday evening thanked all the leaders and legislators “for putting politics aside to address decades of inequity.

“The Illinois House took a significant step tonight by passing an education funding plan that provides equity and stability for children across Illinois,” he said.

Contributing: Fran Spielman

Tina Sfondeles reported from Springfield and Lauren FitzPatrick reported from Chicago