West Virginia teachers and students could head back to class as early as Wednesday after the governor signed a bill which gives the educators a 5 percent pay hike and ends their nine-day strike.

Gov. Jim Justice signed the bill at an afternoon news conference Tuesday, announcing the agreement also grants a 5 percent pay raise to all state employees.

Robert Ray/AP

Teachers celebrate after West Virginia Gov. Jim Justice and Senate Republicans announced they reached a tentative deal to end a statewide teachers' strike by giving them 5 percent raises in Charleston, W.Va., March 6, 2018.

"I have always believed in education and believe it should be our centerpiece," Justice said prior to signing the bill as he sat on a stage with lawmakers and teachers' union officials standing behind him. "Today we are making an investment, we are making an investment in education."

He said he will also write a letter to the state superintendent asking for "flexibility" in the 180-day school requirement so that students and teachers won't have to make up the nine days they were out of the classroom.

"Our children have suffered enough. We need to return some sense of normalcy to the education process," Justice said.

The state Senate and House both voted unanimously to approve the bill.

The 35,000 education employees walked off the job on Feb. 22, demanding higher pay and better benefits after the governor signed a 2 percent pay raise for next year. Justice reconsidered after an initial round of protests, and the House of Delegates later approved a 5 percent increase.

But the Senate's insistence on a 4 percent raise Saturday prompted the union to extend the strike.

Tyler Evert/AP

Hundreds of teachers wait in a line to enter the State Capitol, March. 5, 2018, in Charleston, W.V. Hundreds of teachers from 55 counties are on strike for pay raises and better health benefits.

West Virginia teachers were among the lowest paid in the country, earning an average annual income of $45,240, according to the Bureau of Labor Statistics. They had gone without a pay raise for four years.

Randi Weingarten, president of the American Federation of Teachers, and AFT-West Virginia President Christine Campbell both praised the deal as a "victory."

"I'm proud to be in West Virginia today to stand with the educators and school personnel who stood strong and stood together to fight for what they need to do their jobs and stay in the profession, and for what their kids need to thrive," Weingarten said in a statement.

Campbell added: "The strike and its strong outcome should be seen as a shot across the bow to every lawmaker who may underestimate the support teachers have, the hard job they do and their willingness to stand up for what they deserve as they educate the next generation.”

Earlier in the day, Justice announced on Twitter that a deal had been reached.

"I stood solid on the 5% Teacher pay raise and delivered," Justice wrote in his tweet. "Not only this, but my staff and I made additional cuts which will give all State employees 5% as well. All the focus should have always been on fairness and getting the kids back in school."

Justice said the pay raise will be paid for by reducing spending in other areas of state government.

During the committee meeting earlier Tuesday, state Sen. Craig Blair said the deal included at $20 million spending reduction. He said cuts will likely be made to general services and Medicaid.

But Justice noted the state's Medicaid system ended the last fiscal year with a $173 million cash surplus.

"There's no need to worry one instant about a Medicaid cut," Justice said. "We're good there, we're good."

West Virginia Gov. Jim Justice arrives at the capitol in Charleston, W.V., March 5, 2018, the eighth day of statewide school closures due to a teachers' strike.

Teachers said they were eager to get back to the classroom.

"Hopefully this shows them we stand up for what we believe in," middle school teacher Penny Light told ABC News. "When you truly believe in something, you can stand up for it -- and the lawmakers work for us, not themselves."

Teacher Terry Moss added: "We're very excited, ready to go back to school."