Accident and emergency (A&E) departments in Scotland's hospitals have passed waiting-time targets for a second successive month.

A total of 95.2% of all patients were seen and either admitted, transferred or discharged within four hours in August, the second best monthly performance since July 2013.

NHS figures showed there were 142,082 attendances at A&E departments during August, with a quarter leading to a hospital admission.

Just under 400 patients spent more than eight hours in an A&E department while 32 patients spent more than 12 hours waiting.

In July, 95.8% of all patients were seen within four hours, the best monthly performance since the same period in 2013.

The Scottish Government has set the interim target of having 95% of patients in A&E dealt with in four hours, with figures for the week ending September 27 showing this was achieved, with exactly the target percentage treated in that time.

"Core" performance, covering Scotland's busiest hospitals, was 94.5% in August.

Health Secretary Shona Robison praised the work of medical staff and said health boards need to sustain improvements throughout winter.

She said: "This is the second highest performance we have seen in any one month since July 2013. Core performance for the month of August is 94.5% and long waits over twelve hours have more than halved compared to the previous month.

"For the week ending September 27, core performance is 95% - nearly two percentage points higher than the equivalent week last year and an overall improvement of nearly nine percentage points since weekly reporting began in February.

"It is crucial, especially as we head into winter, that NHS boards work hard to sustain recent improvements. The Scottish Government will go on providing full support in terms of planning and investment for these efforts.

"Winter will continue to bring extra pressures that affect performance but the NHS has appropriate plans and processes in place to allow a prompt recovery.

"This year we have put in place further measures to help our NHS cope with winter. Our winter guidance for boards was issued two months earlier this year compared to previous years, and additional investment of £10.7 million will help ease pressure."