A potential crippling strike on the Long Island Rail Road was averted on Thursday, Gov. Andrew Cuomo announced in New York City.

The agreement, which includes health-care contributions from the LIRR’s 5,400 workers, also comes with 17 percent wage increases as recommended by the Presidential Emergency Board.

The contract resolves a four-year labor dispute and will expire in 6-1/2 years.

“The Long Island Rail Road is a critical artery in connecting the downstate region, and the men and women who keep it running play a vital role in the lives of our commuters and in the communities that the LIRR serves,” Cuomo said in a statement. “Resolving this contract dispute is the right thing to do, and the agreement we have reached today is fair to all parties. It recognizes the many contributions of the LIRR’s hardworking employees, while also maintaining the fiscal integrity of the MTA. I thank everyone involved in these negotiations, especially UTU Chairman Anthony Simon and MTA Chairman Tom Prendergast, whose collective dedication to the needs of LIRR commuters made this agreement possible.”

Cuomo in a news conference insisted the final agreement represented a fair contract with concessions from both sides.

Fare hikes in the Metropolitan Transportation Authority’s system won’t be used to pay for the contract, but the MTA’s financial plan will have to be revised to accommodate the agreement.