The union said it had accepted a 2.5 per cent pay rise backdated to April and a “Cop26 payment” for all staff of £300.
Transport during the 13-day UN climate summit, which is drawing world leaders and thousands of delegates to Glasgow, was set to be heavily disrupted by rail strikes amid a dispute on pay and conditions.
In a letter released to union members following the agreement, RMT general secretary Michael Lynch said: “By accepting the offer, ScotRail stated that it would mean all current disputes between your union and the company would be resolved and that all current and planned industrial action would be withdrawn immediately.”
Mr Lynch’s said the union’s offer was accepted “unanimously” by delegates.
In response to the announcement, ScotRail’s chief operating officer Ian McConnell said: “We have reached a pay agreement with the RMT trade union that resolves strike action.
“We look forward to Scotland’s Railway playing its part in delivering a successful Cop26 next week.”
Earlier this week, Scotland’s Transport Minister Graeme Dey warned he was “not optimistic” that a resolution would be reached with the RMT before the 5pm deadline.
He was facing calls to quit if a deal could not be reached to prevent the strike during Cop26.
In response to the recent announcement, Mr Dey said: “Following recent discussions we are pleased that all four trade unions have now agreed to accept this very good pay offer on behalf of their members.
“We are proud to have brokered and funded a deal which gives Scotland’s rail workers a decent pay rise and improved terms and conditions, in contrast to conditions for rail workers under the UK Government.
“We are also pleased that the RMT reached out to restart discussions based on the offer that had been made to them on Sunday. Now an agreement has been confirmed the strike action will thankfully now come to an end.
“As well as getting the pay rise they deserve, railway workers can now go back to delivering rail services for people right across Scotland and as well as for those attending Cop26.”
Opposition parties took aim at the SNP for the delay in accepting the union’s call for a pay rise, but welcomed the announcement.
Scottish Labour’s transport spokesperson Neil Bibby said: “This eleventh hour deal may help the SNP save face but it won’t fix the mess they’ve made of our railways.
“However welcome the pay deal is, it doesn’t undo the contempt the SNP have shown rail workers over the last two years.
“It is disgraceful that it took the risk of embarrassment at Cop26 to convince the SNP to give rail workers the fair pay they deserve.”
Additional reporting by PA