After 27 months of contentious negotiations, the Boston Teachers Union and the School Department finally struck a tentative agreement early Wednesday morning that should usher in a more rigorous system of judging teacher performance and that provides ­extra help for teachers who need it.

The agreement came together at about 2:30 a.m., 11 hours after the two sides sat down ­together for the first time since talks broke off almost a month ago. The gathering was a last-ditch attempt to work out an agreement before having the state Department of Labor ­Relations recommend its own resolution to the stalemate.

Tuesday’s talks began as teachers in Chicago were striking amid a contract dispute largely tied to overhauling the way teachers are evaluated, an issue that had until recently been a sticking point in the ­Boston negotiations. Both the Boston and Chicago teachers belong to the American Federation of Teachers.

At a press conference to unveil the deal, held in a cramped room at Boston City Hall, representatives from both sides ­appeared jubilant and showed no signs of exhaustion. Negotiators from both sides stood behind Mayor Thomas M. Menino as he announced a contract that he promised “will take our schools to new heights.”

Get Fast Forward in your inbox:

Forget yesterday's news. Get what you need today in this early-morning email.

“Change is hard and often hard fought,” said Menino, who praised the School Department and the union for maintaining a level of professionalism during the talks. “Neither side let their frustrations spill over on the students of the Boston public schools.”

In Massachusetts, it is illegal for teachers to strike. But even as the talks turned acrimonious, the Boston Teachers Union never resorted to the kinds of protest that can rile parents and students and pit their members against one another, such as imposing a work-to-rule order, during which teachers stop writing college recommendations for students and other extra activities.

Richard Stutman, the union president, said at the press conference that the tentative agreement meets the goals the union established at the start of the negotiations. “We wanted a contract that is good for students, fair to members, and afford­able to the city,” he said

The accord is expected to bring sweeping changes to the way the School Department evaluates teachers, as it complies with changes to state rules last year that make student test scores a central part of judging a teacher’s performance.

That new evaluation system, which will be rolled out during the next two years, will provide remedial plans for teachers with unsatisfactory job reviews and could speed
termination of those who show no signs of improve­ment.

The agreement also ends the decades-old practice of automatic annual pay raises for all teachers, regardless of how they measure up. Now, teachers with an overall unsatisfactory job ­review will not receive a pay raise until they show improvement.

Mitchell Chester, the state commissioner of elementary and secondary education, said he hoped the agreement will motivate dozens of other school districts and unions in the state to reach agreements on new teacher-evaluation systems.

“Boston has set a high-water benchmark for that and shows it can be done,” Chester said.

The six-year contract, which would be retroactive to the expi­ration of the previous agreement in 2010, must still be approved by the School Committee and the union’s more than 5,000 members. The City Council also must approve funding the contract, which would provide what the two sides called a 12 percent cost-of-living increase during six years, at a projected cost of more than $136 million.

Superintendent Carol R. Johnson praised the agreement, declaring, “We think this is a great day for the children of Boston.”

But some organizations pushing for dramatic changes in the city’s 128 schools criticized the School Department for making too many compromises, most notably abandoning a proposal to add 45 minutes to the school day. Critics said the concessions produced a tentative pact with only incremental changes.

“This is a contract that needed to really have significant ­reform to allow the Boston public schools to be competitive with charter schools,” said ­Samuel Tyler, president of the Boston Municipal Research ­Bureau, a watchdog funded by businesses and nonprofits, noting that charter schools have longer school days.

Councilor John Connolly, who chairs the City Council’s Education Committee, characterized the tentative agreement as “a half step forward” at best.

“This is a six-year contract with no progress on longer school day, and the evaluation standards for teachers are at the bare minimum requirements,” Connolly said. “This is not how you close the achievement gap and attract middle-class families into an urban system.”

Paul Grogan — president of the Boston Foundation, a charitable organization that funds many education initiatives — said the tentative pact shows the limits of collective bargaining and that more fundamental changes in education must come from the state. He noted the biggest change, overhauling teacher evaluation, was mandated by the state.

“The city may have done as well as they possibly could,” Grogan said. “Fastening our hopes for dramatic changes on the collective bargaining process is a vain pursuit.”

The announcement of a tentative deal surprised many supporters of the schools. Before Tuesday’s negotiating session, Stutman appeared ready for a long haul ahead and challenged Johnson that morning to a public debate on the contract.

But by the time the two sides gathered at 3:30 p.m. at a Dorchester union hall for electrical workers, both parties agreed that the largest stumbling blocks had been removed and disagreements existed only on smaller, low-profile proposals, some of which were agreed to, while others were tossed aside for the sake of getting an agreement.

The session was the culmination of a flurry of activity in recent weeks.

In late August, the state Depart­ment of Labor Relations announced it would investigate and recommend a resolution to the stalemate, at the request of Menino, who had grown frustrated with the talks.

Menino was annoyed that after the School Department gave up on a proposal in July to extend the school day by 45 minutes, the biggest sticking point in the talks at that time, a new stalemate emerged on teacher evaluations.

The prospect of state intervention appeared to compel the union to offer a compromise a few days later. It proposed accept­ing the city’s offer on wage increases if the School Depart­ment agreed to adopt a state prototype for teacher evaluations and a few other items, such as reducing class size in grades 6 and 9.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.