The move came after a new pay offer was presented to the Rail, Maritime and Transport union (RMT) and Transport Salaried Staffs Association (TSSA), which represent 25,000 staff at Network Rail .
Train operators, including ScotRail, said services would now run as normal on both Bank Holiday Monday and Tuesday.
Hours before the breakthrough, which came on the fourth day of peace talks at the conciliation service Acas, the firms had announced a near shutdown of the network.
Only about one in ten trains would have due to run over the two days, with none beyond the Central Belt in Scotland.
A few Virgin Trains East Coast services as far as Edinburgh would have been the only cross-Border trains to operate.
Ahead of that announcement, The Scotsman revealed on Tuesday that ScotRail services would have been disrupted on Monday as well as Tuesday.
This is because of the overtime ban, which would have covered Monday until the start of the planned 24-hour strike at 5pm. The Scotsman reported last week that industry sources had expected agreement to be reached ahead of the strike, as has happened in several previous disputes between the RMT and Network Rail over the past decade.
However, the scale of the disruption that the action would have caused is likely to have prompted some passengers to change their travel plans.
The RMT union called Britain-wide strikes in 2004, 2006 and 2010, only for them to be called off or halted by legal action.
The last GB-wide rail stoppage was under British Rail, involving the main train drivers’ union Aslef in 1995.
RMT general secretary Mick Cash said yesterday: “Following the Acas talks, RMT has received a revised offer that enables us to suspend the planned industrial action while we consult in full with our Network Rail representatives.”
Manuel Cortes, general secretary of the TSSA, said: “Our negotiating team at Acas has received a revised offer from Network Rail.
“As a result of this, they have suspended the planned industrial action, pending the outcome of a meeting of our workplace representatives next week.”
Lawyers for Network Rail halted plans to take legal action against the TSSA in the light of developments.
Bruce Carr QC, for Network Rail, told a judge at a High Court hearing in London that Network Rail was not proceeding with an application for an injunction.
He told Mr Justice Jay: “There has been progress.”
Network Rail had challenged the union to cancel its strike because of alleged “numerous defects in ballot information”.
Phil Verster, managing director of the ScotRail-Network Rail Alliance, said: “I would like to thank all our customers and colleagues for their patience during these last two weeks.”
Deputy First Minister John Swinney said: “This is welcome news for passengers who were facing widespread cancellations.
“It is important that lessons are learned from this to reduce the likelihood of future action and ensure passengers and businesses can plan ahead with confidence.”
UK Transport Secretary Patrick McLoughlin said: “I am very pleased the unions have made a decision to suspend their planned action.
“Passengers right across the country will welcome this news and the knowledge that the extensive disruption threatening the Bank Holiday and the return to work on Tuesday has been averted.”