RICHMOND — Virginia House and Senate negotiators have reached agreement on a two-year state budget that would provide 5 percent pay raises for teachers, state employees, university employees and state-supported local employees.

Largely completed late Wednesday night, the $135 billion spending plan would also give state police an 8 percent pay raise and bonuses based on years of service, measures aimed at shoring up chronically low pay that has led to retention problems.

Reaching a deal became easier early this month when Gov. Ralph Northam (D) announced that state tax revenue was running $730 million higher than expected, which created room for the Democrats who control both chambers of the General Assembly to fund the broad increases in pay.

Pay raises for teachers and state workers had been planned a year ago when Virginia’s economy was flush but were put on hold in the summer after the coronavirus pandemic prompted a vast economic shutdown.

The new money reflects a faster-than-expected rebound for Virginia’s economy, as well as the benefit of millions in pandemic relief money from Washington.

“I am extremely happy with the way it came together, given the fact that we are in the midst of a pandemic,” said Del. Luke E. Torian (D-Prince William), chairman of the House Appropriations Committee.

With many small businesses continuing to suffer, House and Senate negotiators also compromised on a plan allowing employers who received federal aid to avoid paying taxes on some of the assistance payments.

Under the agreement, businesses will not face state taxes on expenses up to $100,000 that were covered by the federal Paycheck Protection Program or similar state grants. That relief amounts to just under half of a $221 million package of coronavirus-related tax relief for individuals and businesses, including forgiveness of taxes on PPP loans and extended deductions for charitable contributions.

About $78 million in federal and state funds are aimed at purchasing personal protective gear to protect public safety officials against the coronavirus. And roughly $109 million in federal funds are aimed at helping administer coronavirus vaccine and boosting communication about the health crisis.

The budget agreement includes $443 million to protect K-12 school systems against losses brought about by the pandemic, plus $40 million to help provide for summer programs as schools begin to reopen. An additional $50 million would fund extra support staffers at public schools, such as social workers, psychologists and nurses.

In addition, a “cost of competing” adjustment that helps school systems in high-cost areas such as Northern Virginia will be funded at 18 percent, up from the 10.6 percent that had been proposed, at a total cost of $14.6 million.

Higher-education facilities would get $40 million to help offset staffing needs and reduce pressure on tuition.

Thanks to the extra tax revenue, the compromise budget also includes total payments of about $900 million into the state’s reserve funds — $250 million more than had been requested by Northam. Reserves will total $2.1 billion by the end of 2022, a stockpile aimed at preserving the state’s coveted AAA bond rating.

Almost $15 million is set aside to cover the cost of new bills passed by the House and Senate that require the sealing of someone’s criminal record after nine years for a number of drug-related and misdemeanor crimes.

One key initiative that survived the budget process but has yet to win legislative approval is a mechanism making it easier for health-care workers and first responders to qualify for workers’ compensation payments if they were infected with the coronavirus in the line of duty.

The House has passed two bills allowing the workers a presumption that their illness from the coronavirus was work-related if they dealt directly with infected people, and made the benefit retroactive to the beginning of the pandemic last March. One bill, sponsored by Del. Chris Hurst (D-Montgomery), focuses on health-care workers. The other, sponsored by Del. Jerrauld “Jay” Jones (D-Norfolk), addresses first responders such as firefighters.

The Senate resisted making the benefit retroactive, for fear that the potential cost could be excessive. Virginia has a private workers’ compensation system, funded by employer contributions. Estimates put the potential cost to employers in the range of $12 million to $15 million, though the public cost of covering first responders is uncertain.

The budget agreement includes $2 million for workers’ compensation for state employees, anticipating that some form of retroactive coronavirus presumption will be passed.

Hurst and Jones have made an all-out final push over the past few days.

“If we can’t do this for our heroes, what the hell are we even doing here?” Hurst said Thursday, with conferees from the House and Senate still working on ironing out some kind of agreement on the measures.

At least 17 other states and Puerto Rico have approved a workers’ compensation presumption for front-line workers in the fight against the pandemic, and most of those were retroactive, according to a survey by the National Coalition of State Legislatures.

On Thursday, negotiators reached agreement on Hurst’s bill for retroactive coverage of health-care workers, sending it back to the House and Senate for a vote in the next two days. Jones’s bill was still being discussed.

The deal between Senate and House negotiators will be taken up by both chambers on Saturday. Approving a budget is usually the last major item on the docket for a General Assembly session. Once that is done, this year’s session will be able to adjourn — although for procedural reasons, the actual adjournment is scheduled for Monday.