Bob Crow, the leader of the Rail, Maritime and Transport union, reached a settlement after face-to-face talks with Network Rail's chief executive, John Armitt, hours ahead of a high court hearing on the validity of the union's strike ballot.
Network Rail, which had threatened to close its final salary pension scheme, said it would continue to allow employees to join after five years' service as a reward for loyalty.
The RMT cancelled a 24-hour walkout by 7,500 signallers and maintenance workers which was due to begin at 6.30pm on Tuesday. However a parallel strike on the London Underground will still go ahead.
Mr Crow said: "We are very happy. We had been told we were living in a dream world and that we had no chance of getting this scheme reopened.
"Someone told us that there was more chance of hell freezing over. But thanks to our members being prepared to take industrial action and shut down the railways we have been able to get this scheme reopened."
Rail industry sources suggested Mr Crow had softened his position after facing defeat in a high court challenge to the RMT's strike ballot today.
Network Rail had applied for an injunction to stop the strike on the grounds that nearly 1,000 of the staff who were sent voting forms were "suspicious", with inaccurate or unavailable details of their workplaces and job titles.
Some members were listed as working at signal boxes which no longer exist - including one site in Garston on Merseyside which burned down two years ago.
The agreement sets an awkward precedent for other employers in the public and private sector who try to close final salary pension schemes.
The Trade Union Congress general secretary, Brendan Barber, said: "This is a good deal that shows that final salary pension schemes can be saved."
Train operating companies were making contingency plans for shuttle services to keep intensively used lines open during the strike, which appeared likely to cause the cancellation of nine out of 10 trains.
It would have been the first national rail stoppage since an acrimonious dispute in 1994 orchestrated by the late RMT leader Jimmy Knapp.
Caroline Jones, a spokeswoman for the Rail Passengers' Council, said: "This is good news. We know from the passengers we've been talking to that they weren't looking forward to this strike. Many will be relieved that they won't be facing disruption next week."
The RMT will put the compromise over pensions to its members in a fresh ballot, with the leadership recommending acceptance.
The Transport Salaried Staff Association, which announced yesterday its Network Rail members had voted by 53% to 46% for a work to rule and an overtime ban, is also likely to recommend acceptance of the deal.
The RMT came under renewed pressure last night to cancel its tube strike, which is likely to inconvenience 3 million people.
The London mayor, Ken Livingstone, said: "I have made it clear from the beginning that the way forward is to continue the negotiations between the trade unions and London Underground management to reach a long term agreement. We are, of course, ready to continue those talks at any time."
Mr Livingstone added that he would cross a picket line if he were an RMT member on the tube - a remark described as "not helpful" by the union.
The RMT wants a reduction in hours to a four-day working week for its 7,000 station staff on the network.
LU has offered a 6.5% pay rise over two years and a phased reduction in the working week to 35 hours by 2006.