(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.

David Trone, an analyst at Fox Pitt Kelton Cochran Caronia Waller said that while early signs of consumer losses could be nearing a peak, the "revenue franchise has clearly been impaired, under the firestorm of criticism/pressure from politicians and journalists, which has driven away top talent and distracted those that remain," he writes in a note.

The company, which has $1.85 trillion in assets, has received a total of $45 billion in federal bailout funds. It is set to complete an exchange offer next week that would make the U.S. government a 34% stakeholder in the company. It also received some $300 billion more in guarantees on risky assets. Other companies, including JPMorgan Chase ( JPM), Goldman Sachs ( GS), Morgan Stanley and US Bancorp ( USB), in the second quarter repaid government investments made through the Troubled Asset Relief Program.

Under pressure from regulators, Citi separated its core businesses from non-core units and troubled assets into a so-called good bank, Citicorp, and bad bank, Citi Holdings. The company has been working to pare down its Citi Holdings assets, but continues to be weighed by consumer loan losses and pressure from regulators about the pace of changes. Pandit reportedly has drawn particularly intense fire from FDIC Chairwoman Sheila Bair.

The second quarter is the first in which Citi broke out financial results for Citicorp and Citi Holdings.

Citicorp, which includes regional consumer banking and institutional clients businesses, made $3.05 billion, an 11% decrease compared to the year-earlier period results. The drop was driven by a 78% decline in profit from its regional consumer banking operations. Revenue decreased 11% to $14.9 billion. Citi blamed the decrease on the impact of foreign exchange, credit losses in its North American card securitization trusts and lower overall volume.

Credit costs in Citicorp totaled $2.8 billion, of which $1.2 billion was additional reserve building, the company said.

Citi's North American consumer business, which is primarily its U.S. retail franchise, also has shown signs of the poor economy. The company said that retail banking revenue was flat compared with the prior year, while revenue from its credit card business fell 30% to $806 million, reflecting higher credit losses in the securitizations, lower fees and a decrease in gains on sale. The managed card net charge-off rate rose 471 basis points to 10.25% for the second quarter, Citi said.

"In our consumer businesses, the story is very simple," Pandit said on the call. "Our credit card and mortgage losses are elevated because of where we are in the cycle."

"Cards and mortgage are what we need to work through and we are very focused on this," Pandit said.

Still, the company has seen some "encouraging signs," he added. Similar to remarks made on the JPMorgan Chase ( JPM) earnings call on Thursday, Pandit noted that the "rate of growth" on consumer losses "may be moderating, which of course also has implications for future additions to reserves."

On the institutional side, profit rose 16% to $2.84 billion in the quarter, driven by a 26% jump in revenue from fixed income markets, debt underwriting and transaction services. But the company had lower revenue from investment banking, equity markets and writedowns, unlike its rivals Goldman Sachs ( GS) and JPMorgan Chase.

Citi Holdings, on the other hand, made a profit of $1.35 billion, up from a $5.22 billion loss in the comparable period last year, primarily from a gain on the Smith Barney joint venture and improved values on its special asset pool. But its consumer lending business performed steadily worse.

Bank of America ( BAC), another bailout recipient, posted a $3.2 billion, or 33-cents-a-share, profit Friday after deducting preferred dividends, as the company said results were driven by "continued strong revenue performance in the wholesale capital markets businesses as well as in home loans." Analysts surveyed by Thomson Reuters expected the Charlotte, N.C.-based financial institution to earn 28 cents a share.

JPMorgan Chase on Thursday said it made $2.7 billion, or 28 cents a share, for the second quarter, blowing past analyst estimates of 4 cents a share.

Shares of Citi were trading down a penny to $3.02 Friday.