Scotland sweltered and strained through the continuing heatwave yesterday as the blazing sun melted roofs and roads and threatened to buckle rail tracks.

The mercury hit a high of 31.9c in Glasgow - just shy of the UK’s hottest place, Porthmadog in Wales, which hit 33c.

It also beat Wednesday’s record-breaking 31c high in Glasgow, making yesterday the hottest June day in more than two decades.

The heat sparked speed restrictions on rail routes, leaving passengers facing disruption for much of the day.

Rail lines outside Glasgow Central were even painted white to absorb some of the heat in a bid to reduce the impact on services - coming the morning after cancellations and long delays on commuter routes due to heat causing signalling issues.

David Dickson, Network Rail's infrastructure director for the ScotRail Alliance, said specialist extreme weather teams were monitoring track-side temperatuers, adding: "On very sunny days, rails in direct sunshine can be as much as 20c above air temperature causing the steel to expand markedly and could, if not carefully monitored and action taken, buckle causing travel disruption.”

Elsewhere, gritters were sent out after roads were reported to be melting in high temperatures. Poor conditions were reported on the A920 between Huntly and Dufftown and on the A916 Craigrothie to Cupar road.

In Glasgow, the “weatherproof” membrane on Glasgow Science Centre’s roof melted and dripped down the side of the building.

The blistering heat also saw safety warnings issued by police for a need to be cautious around water, particularly quarries, and a warning from the NHS to keep an eye on “at risk” friends, family and neighbours, including the over-65s, young children and those with heart and lung conditions.

Scots were also being asked not to waste water due to concerns reservoirs may run low.

Scottish Water issued warnings over supplies in Elgin, Forres, Kinloss and Stornoway, asking customers to “use water wisely”.

And police also sent out a reminder on social media of the dangers of leaving dogs in hot cars.

The warning stated: “The temperature in a parked car, even in the shade with partly open windows can rapidly reach a level high enough to seriously harm or kill your pet.”

As sun-lovers flocked to parks and beaches, the weather was also enjoyed by the European brown bears at Camperdown Wildlife Centre in Dundee, who were given frozen fruit and misting sessions to keep cool.

Met Office forecaster Peter Sloss said: “The temperature didn’t quite beat the June record of 32.2C from 1893, but it was getting close.

“It will not be quite as hot on Friday - it will still be in the high 20s, but not quite the level of the last couple of days due to an easterly breeze from the North Sea freshening the air up.”

Disruption continued on the rail last night due to high track temperatures, with services to and from Glasgow Central High Level reduced.

A ScotRail spokesperson said: “We are sorry to customers and understand how frustrating it is when these things happen.

“Due to a number of infrastructure problems and speed restrictions imposed by Network Rail, many of our services were disrupted today.

“We have been doing all we can to keep customers moving, including arranging for train tickets to be accepted on local buses and trams wherever possible.”