A funny thing happened after school superintendents looked at school aid data released Tuesday night by the State Legislature.

For the first time in five years, they started smiling. Some even sounded happy.

Under an agreement between Gov. Andrew M. Cuomo and the State Senate and Assembly, schools across the state will be getting 4.7 percent, or almost $1 billion, more in aid next year.

“It is great, great news,” said Lake Shore Superintendent James Przepasniak.

“Much better,” said James Knowles, interim superintendent of Niagara Wheatfield.

“It actually turned out better than we thought it would be,” said Jeffrey Petrus, assistant superintendent for business at Orchard Park.

“It’s very helpful during certainly what continues to be challenging fiscal times,” Williamsville Superintendent Scott Martzloff said.

The agreement reallocates some funding the governor had identified for education and adds more to that pot.

Almost all districts in the Erie Niagara region will see increases. Only East Aurora will get less money than last year, but the drop is less than the governor’s proposal released in January and is partly due to the district’s not receiving aid for converting to full-day kindergarten that it received last year.

Districts will see varying increases, from 1.4 percent in Wilson in Niagara County to 11.36 percent in Sloan, not including building aid. Buffalo’s aid will go up $15.65 million, or 3 percent.

Lake Shore was looking at a budget gap of $1.5 million before the agreement on aid was reached.

“Just Monday evening, the board discussed reductions of almost $900,000, which was staff, programs and cuts across the district in all areas,” Przepasniak said. “Now that discussion will be much different at our next budget work session.”

Anything that improves the situation is a positive, said Niagara Wheatfield’s Knowles, whose district had been grappling with a $1.4 million shortfall. He said the district has cut 91 positions in the last two years and is running out of places to look for money.

“Anytime you would fall short, you would have to look at what kinds of things are not mandated,” he said. “Look at staffing, all the things you don’t want to look at, because it’s people.”

In Orchard Park, the 4 percent increase in aid will pay for some unexpected increases in special education and health insurance costs. The district will be able to continue its current programs and will partially fund the cost of a girls hockey coach, the assistant superintendent for business said.

An anonymous donor contributed $2,500 for the coach’s stipend, but volunteers will still have raise about $10,000 for the program to continue, Petrus said.

Williamsville, Erie County’s largest suburban school district, was contemplating its largest tax levy increase in eight years, 4.26 percent, before the state aid figures were released.

That levy increase includes funding the installation of 98 more security cameras than originally planned next school year to avoid paying for them in the following year, which also looks to be a tight budget.

With an increase in aid of 2.27 percent, the district should be able to buy the cameras and lower the tax rate below 4 percent, the superintendent said.

“Certainly we’re sensitive to economic times faced by residents,” Martzloff said. “Even with this increase, we’re still not where we were in terms of state aid back in 2008.”

That was the year the foundation aid formula gave districts a large increase. Fiscal woes then forced the state to cut back.

Rick Timbs, executive director of the Statewide School Finance Consortium, said that even with an increase of more than 4 percent, schools are not back to the high aid mark.

“This is a temporary reprieve at best. They may not have to make as many cuts as they had planned,” he said. “When you look long term, it is nowhere near a panacea.”

Some of the extra money funneled to districts comes from the $203 million fiscal stabilization fund and money for education reform initiatives the governor proposed.

Timbs said those were to be one-time aid packages, and it’s not known if they will be included again next year.