Lawmakers in the Democratic-led Assembly late Tuesday night reluctantly approved a massive education spending bill as part of the budget, 92-54, following a marathon, six-hour debate.

The state Senate had approved the bill earlier in the evening, 36 to 26.

But the education reform legislation as proposed by Gov. Andrew Cuomo was always considered to be a heavier lift in the Assembly, where the state’s teachers’ unions are especially close with lawmakers.

The legislation includes changes to the state’s teacher evaluation law, which will rely on a mix of state testing and in-classroom observation. Tenure will take longer for teachers to obtain and poor-performing teachers can be fired, even those with tenure.

Struggling schools deemed to be “failing” will have a year to reverse their problems are face a state receivership administered by the Department of Education.

The measures are staunchly opposed by the teachers unions, who spent the last several weeks trying to weaken Cuomo’s education proposals.

Both the United Federation of Teachers and the New York State United Teachers blasted Cuomo for what they saw as his demonizing of teachers and dogged his events around the state in protest.

Still, even as a number of other measures melted away from the budget talks, Cuomo stuck with including education reforms, as well as ethics legislation, in the final budget agreement.

Enacting the evaluation measures by November will give school districts a planned boost in education aid.

Democratic lawmakers expressed disapproval for the education reform measures included in the spending plan, which boosts school aid by $1.3 billion over last year.

Indeed, the added spending in the budget bill was what spurred many lawmakers to approve the measure.

Lawmakers touted the negotiations with Cuomo and Senate Republicans that ultimately included more school aid than the $1.1 billion that was initially proposed in the executive budget in January.

In the end, lawmakers insisted they couldn’t vote against a spending plan for schools, even if it did include a number of measures that they opposed.

“It’s much better than it was a few days ago,” said Bronx Assemblyman Jeffrey Dinowitz, citing the added school aid.

“I feel there are too many good things in this bill,” said Westchester County Assemblywoman Amy Paulin.

But lawmakers, even voting for the bill, bashed it at the same time during the debate.

“Attacking our school districts, attacking our teachers is not real reform,” said Assemblyman Harry Bronson.

Republican Assemblyman Michael Fitzpatrick, in a rare show of support for Cuomo on the floor, thanked him for taking aim at the “entrenched” teachers union.

The measure, known as the Education, Labor and Family Assistance budget bill, included a suite of ethics reform legislation that address client disclosure for state lawmakers who are attorneys as well as per diem and campaign finance reform.

Some Republicans attacked the packaging of the two issues.

Republican Assemblyman Bill Nojay said ethics and education were “mashed together for the oldest political reasons.”

But there was also a sense among lawmakers that the education reform measures approved in the budget will not just have wide-reaching effects for schools and politics, but will likely be before them again next year.

“We will be back here again revisiting this issue,” said Assemblyman Fred Thiele. “I feel like we are rearranging the deck chairs on the Titanic.”