Canadian National Railway has reached a tentative agreement with the union representing its mechanical workers and clerks, the company announced on Monday, just two weeks after workers voted to authorize a strike.