A packed commuter train pulled up yards from disaster when steel rails buckled in the summer heatwave.

The alert driver spotted the warped track as the South Central service approached platform two at Gatwick Airport.

He stopped the train, averting a potential derailment, rail bosses said.

Passengers were cleared from the carriages and put on a substitute service as an investigation was launched.

An examination revealed the steel had buckled as the rails reached 51C (124F).

When the steel track had cooled, repairs were carried out and the line, closed after Tuesday's discovery, reopened in time for yesterday morning's rush hour.

Track custodian Network Rail disclosed details of the near-disaster last night as pressure grew from commuters angry at the 60mph speed restriction imposed on services in response to the continuing heatwave.

Dozens of trains across the country have been cancelled and others rerouted.

A spokesman for Network Rail defended its safety-first policy in the light of the incident.

He said: "This clearly demonstrates the problems the heatwave can cause us and why the speed restrictions are required. On this occasion an alternative track was used and there was no delay to passengers. We would like to stress there was no danger to the train."

Gatwick topped the highest temperature tables on Tuesday with a reading of 33C (91F), and was expected to be even hotter today as train travellers faced a fourth day of restrictions.

On the roads, drivers were warned to watch out for the melting carriageways.

Paul Watters, head of roads and transport policy at the AA Motoring Trust, said: "Very hot weather can cause the stones on the surface of the roads to sink, which means roads lose their skid resistance."

Rail travellers were still experiencing problems last night. Commuter David Edwards, 30, from Seven Dials in Brighton, was detoured from London Bridge via East Croydon.

He said: "For a rail network to be brought to a standstill because it's summer beggars belief."