St. Paul public school teachers and administrators reached a contract agreement this week that fortunately averted a damaging strike. Closing school for the system’s 39,000 kids certainly would have compounded the already difficult financial and educational issues the district faces. Both sides should be commended for meeting daily during the last week and settling on a reasonable compromise.

Under the proposed contract with the St. Paul Federation of Teachers, educators would get 1 percent salary increases this year and next. That union had originally asked for 2.5 percent hikes, but district negotiators stuck to their 1 percent offer in the face of mounting budget pressures. The annual raises will take up most of the $4.1 million increase that the district had projected for the contract over the next two years. Still, according to the district’s latest figures, the 2018-19 budget year will have a $17 million projected deficit.

In addition to seeking higher pay, St. Paul teachers union members held rallies to press for many nonsalary demands — including lower class sizes and increased support staff such as nurses, social workers and aides.

Although full details of the agreement have not yet been released, union leaders said in a statement to members: “We won supports for our students, especially our English learners and our students who receive special education services.” The union said it defended contract language on class sizes and strengthened the district’s commitment to restorative justice methods to improve school safety. District officials reported that those nonsalary issues were addressed in “revenue neutral’’ ways.

The proposed pact also calls on the union and the district to work together on new ways to raise revenue for schools. That involves urging more state and federal support for special education, requesting tax increases from voters, and seeking additional private and nonprofit funding.

As St. Paul teachers are poised to approve the agreement, their counterparts in Minneapolis are facing similar issues in negotiating their own two-year contract. This week the Minneapolis teachers union also rallied for higher pay, lower class sizes, and more control over teacher calendars and assignments — all while the district faces an estimated $33 million projected deficit.

The two urban districts have experienced similar patterns in recent years — rising costs along with enrollment declines and the resulting drops in revenue and multimillion-dollar deficits. And both are struggling to improve student achievement for many of their lower-income students of color. Against that backdrop, both districts are considering going to voters later this year with operating-levy proposals.

Before doing that, the school superintendents and boards must focus on strategies that will bring down expenses while still improving educational outcomes. Both districts need new strategies to break the cycle of continuing deficits and attract more students.

There are no easy fixes as St. Paul and Minneapolis schools adjust to the financial realities both districts face.