The city’s rank-and-file police officers have a new contract — the first in years — Mayor Bill de Blasio said on Tuesday, as the city vows that officers will all be wearing body cameras by the end of 2019.

NYPD police officers have been working without a contract since their last one expired in 2010. The new agreement for the more than 23,000 officers will go into effect March 15 and includes back pay from 2012 through last year. The contract covers through July 31, 2017, according to the mayor’s office.

Officers hired after March 15 will make $42,500, almost a 1.3% bump in base pay compared to before. After 5 1⁄2 years that pay jumps to $85,292, according to the mayor’s office.

Officers will also be entitled to a 2.25% pay differential under the new contract.

“We’re clearly asking officers to learn a new way of doing the work and to adjust to a technology and level of transparency they have not experienced before,” de Blasio said at City Hall. “Rather than a long, contentious fight over these issues, we found common ground.”

He said the “additional compensation made sense” when tied to the expansion of body cameras.

Currently, only officers covered under the Patrolmen’s Benevolent Association contract will be required to wear the cameras.

The cameras are currently undergoing a 1,000-camera pilot program to 20 different precincts, de Blasio said. An additional 5,000 cameras will be deployed by July 2018, with the remainder by the end of 2019.

The yearlong pilot program was initially ordered in August 2013.

“A lot of work went into getting here,” PBA president Patrick Lynch said, adding: “What we were able to do is do something different that solves some of our problems, put money into our members’ pockets, so they can focus on policing rather than paying their bills.”

De Blasio said when this contract is ratified (which he called “the last great uncertainty in terms of labor relations”), the city will have “active labor agreements” with more than 99% of the city’s workforce.

The PBA has been without retroactive pay since concluding arbitration in 2015, which only covered 2010 through 2012, according to the mayor’s office.