The Met Office has confirmed that last month was the second warmest July on record in Scotland.
Since the statistics began in 1910, only July 2006 was hotter.
Temperatures were about 2C warmer than the Scottish average for the month. Hours of sunshine were 45% above average.
Rainfall was close to average, as the hot and dry conditions were followed by thunder storms and heavy rain at the end of the month.
The Isle of Tiree in the Inner Hebrides had the sunniest day in the UK, with 15.9 hours on 20 July.
The same day, temperatures reached 30.5C at Glenlee in Dumfries and Galloway.
BBC Scotland weather presenter Christopher Blanchett said: "The prolonged spell of heat meant July 2013 was the second warmest July we've seen in Scotland, on records dating back to 1910.
"However, we also saw close to average rainfall.
"This was thanks to the torrential downpours towards the end of the month - as high pressure lost it stranglehold and the latent heat injected extra energy into the atmosphere - allowing big thunder storms to soak us through.
"In the future, scientists say wet summers will be more common, as arctic ice melts, changing ocean temperatures - which some argue affects the jet stream - diverting more rain our way."