Royal Bank of Scotland has posted a profit of £392m ($514) for the third quarter, compared to an attributable loss of £469m in the same period a year ago.
It marks the third straight quarter in which the lender, which is 71% owned by the government, has posted a profit.
Operating profits came in at £871m for the July to September period, more than the £694m profit predicted by analysts.
The better-than-expected results were driven by falling costs and fewer conduct charges compared to the third quarter of last year.
Litigation and conduct costs fell to £125m from £425m a year ago, while restructuring costs slid to £244m from £469m.
Year-to-date attributable profits came in at £1.3bn compared to a loss of £2.5bn in the first nine months of 2016.
"Our strategy to deliver a simpler, safer, customer-focussed bank, is working," RBS chief executive Ross McEwan said.
"We have grown income, reduced costs, made better use of our capital and continued to make progress on our legacy conduct issues."
RBS has reported nine consecutive years of losses since the government spent £45bn to buy a majority stake in the bank in 2008.
It agreed to pay a £4.2bn fine to the US Federal Housing Finance Agency earlier this year to settle charges that it mis-sold mortgage-backed securities during the financial crisis.
The lender is also under a separate investigation from the US Department of Justice over its mortgage-backed security sales, which is expected to result in a huge fine.
RBS agreed to pay $44m to settle separate charges of securities fraud in the US on 26 October.
The charges relate to RBS attempting to increase its profits at the expense of clients by misrepresenting prices and commissions in trades of mortgage-backed securities.
Prosecutors said the scheme was conducted from 2008 to 2013 and that the bank's employees perpetrated it "with the knowledge, encouragement and participation of RBS supervisors".