After extending the strike deadline a couple of times on Monday, Unifor announced early Tuesday morning it had a tentative deal for its 2,000 members at VIA Rail.
The union won't release the details until its members have ratified the contract, and service will continue at least until members agree to it.
A strike would have paralyzed passenger rail service across Canada.
Unifor represents maintenance workers, chefs, on-board service personnel, customer service staff and sales agents.
The union notified VIA Rail last Thursday it was issuing a 72-hour strike notice after receiving a strike mandate of 99.3 per cent and 99.4 per cent from Council 4000 and Local 100 members.
The sticking point was job security.
"Fighting back against the concession that VIA proposed wasn't easy, but the resolve, commitment, and solidarity of our VIA Rail members, helped the bargaining committees to push forward and achieve this tentative agreement," said Lead Negotiator and Executive Assistant to the National President Scott Doherty.
The strike deadline was originally 12:01 a.m. on Monday, but Unifor pushed that back three times during the day, saying a deal was within reach.