“It appears the strike will end,” Mr. Lee said after the deal was announced.

The pay raise was the main point of contention in the final days of the strike, but the teachers have also demanded some relief from sharply rising health insurance costs. The governor has promised to address that issue through a state task force. Both union leaders and rank-and-file teachers have welcomed that move.

“I think it’s a step in the right direction,” said Kerry Guerini, a teacher from Fayette County, who stood in the Capitol on Tuesday with a sign that said, “Will teach for insurance.”

“A 5 percent raise isn’t going to feel like very much when we have so much coming out for insurance,” Ms. Guerini said. Nevertheless, she added, “I’m ready to go back.”

Mr. Carmichael, whose resistance to the raises had made him a key antagonist for the striking teachers, insisted on Tuesday that he did not want to pass anything “just to appease a special-interest group.” The deal came about, he said, because lawmakers decided to offset the cost of the raises with budget cuts, rather than rely on optimistic revenue estimates the governor had offered.

The raises for state workers were expected to cost the state treasury a total of about $110 million a year. Some of the money for the raises would be redirected from amounts the governor had requested for tourism promotion and the state Department of Commerce, but lawmakers in the Senate said additional spending cuts would probably be required. Mr. Blair, the Republican who heads the Senate’s Finance Committee, said in a meeting that some of the money could be taken from Medicaid.

Mr. Carmichael told reporters that the scale of Medicaid cuts was “not absolutely determined,” because lawmakers were still “scouring the budget” for more places to cut.