The Rail, Maritime and Transport (RMT) union, which earlier this week called off pre-Christmas strikes on ScotRail services, said the 3.5% pay increase was proof that Government austerity measures could be resisted by trade unionism.
The deal was announced as the RMT announced a further strike by signalling workers in Stirling as part of a long-running dispute which has seen the union demand shift changes that would see them work three days a week instead of five.
Bob Crow, general secretary of the RMT, said: "This deal is one of the best collective pay settlements anywhere in industry and rams home the point that while we are being told we have to accept pay cuts and freezes RMT is still out there winning inflation-beating rises."
The RMT also called off a strike at the weekend that had threatened to disrupt ferry services to Orkney and Shetland before Christmas, despite staff being awarded a 4.25% pay rise this year.
The union gave notice of a 24-hour strike by signallers in Stirling on Christmas Eve but said it would consider escalating the dispute if its demand was not met. Network Rail said that previous strikes had made no difference to running trains on time and refused to give way.
A spokesman for the RMT said: "Regretfully, despite considerable efforts by RMT's local reps, management refuse to budge and give in to our call for the 12-hour rosters which all our members in the Stirling area want and which the union knows will deliver a safe and efficient service and which is perfectly normal practice."
A spokesman for Network Rail said: "Meeting the union's demand that signallers begin to work fewer days each week would mean operating a less efficient and more expensive railway."