(Updates closing stock price.)

Citigroup ( C) on Friday reported a surprise second-quarter profit, but sustainability of those results at the troubled bank is still very much in doubt.

Citi said it made $4.27 billion, or 49 cents a share, for the three months ending June 30. But the results were aided in large part by an $11.1 billion pre-tax, or $6.7 billion after-tax, gain associated with the joint venture it completed in June to combine its Smith Barney wealth management unit with Morgan Stanley's ( MS) brokerage operations. Citi said total revenue from continuing operations rose 71% to $29.9 billion.

Analysts, according to Thomson Reuters, expected the big financial firm to post a loss of 37 cents a share in the quarter. In the year-earlier quarter, Citi posted a loss of $2.49 billion, or 55 cents a share.

"For the past several quarters we've had a plan for Citigroup," CEO Vikram Pandit said on a conference call with analysts. "A plan to address costs, assets, headcount, risk and capital. Each quarter we have been successfully executing against this plan and you've seen the results."

Still, Citi's profit came on the back of the Smith Barney deal. Without it, Citi lost $2.4 billion in the quarter, executives said on a conference call. And the company's "most significant challenge" remains its consumer credit businesses, Pandit said.

The company said that total credit costs increased roughly 80% to $12.4 billion. Citi added $3.9 billion to loan loss reserves, bringing the total allowance for loan losses to 5.6% of total loans.

If you liked this article you might like

SEC's Cyber-Gaffe Highlights Risk of Trump Budget Cuts at Agency

China's Banks Halt Business With North Korea Per United Nations Sanctions

Why Hurricanes Won't Force the Fed to Ditch a December Rate Hike

Fed Pares $4.5 Trillion Balance Sheet But Easy-Money Era Isn't Over

Bank Stocks Move Higher as Fed Decides to Start Unwinding Balance Sheet