The NFL and the referees' union reached an agreement at midnight Thursday. It ended an impasse that began in June when the league locked out the officials and used replacements instead.