NEW YORK -- The lockout of Major League Soccer's referees has ended following an agreement on a five-year labor contract.

The Professional Referee Organization, which manages game officials for the U.S. Soccer Federation and MLS, and the Professional Soccer Referee Association announced the agreement Thursday. Replacements had been used for the first two weekends of MLS games.

The PSRA was certified by the National Labor Relations Board last May to represent referees, assistant referees and fourth officials working MLS games, and the sides had bargained since July. The lockout began March 7, a day ahead of MLS openers.

The Federal Mediation and Conciliation Service entered talks, and a tentative agreement was reached Tuesday night that was ratified by the union membership and approved by PRO's executive board.

''First contracts sometimes pose difficult challenges as the parties seek to define the parameters of a new formal relationship,'' FMCS acting director Scot L. Beckenbaugh said in a statement.

The agreement runs until Jan. 15, 2019. Lucas Middlebrook, a PRSA lawyer, said the deal includes ''substantially better'' compensation and ''a number of non-economic work rule protections such as a just-cause standard for certain disciplinary matters and standardization of fitness testing.

''In addition, the officials now have a contract protecting important quality-of-life items such as travel standards, vacation time and advance notice of match assignments,'' he said in an email.