Bank posted a £355m profit before tax for July to September even though analysts expected a loss.