Citigroup ( C), the world's largest financial services firm, reported a 4% gain in net profit in the second quarter, but earnings and revenue both fell a bit short of Wall Street expectations.

Earnings gains at Citigroup were led by a solid performance in the company's investment banking group.

In the quarter, the New York-based firm earned $5.27 billion, or $1.05 a share, up from $5.1 billion, or 97 cents a share, a year ago. Revenue rose 10% to $22.12 billion, compared with the year-ago period. But revenue was unchanged from the first quarter of this year.

On an operating basis, Citigroup's earnings rose 11% to $5.26 billion, also $1.05 a share.

Analysts, as surveyed by Thomson First Call, were looking for earnings of $1.06 a share on revenue of $22.45 billion.

In premarket trading, shares of Citigroup were up 7 cents to $47.65.

Citigroup is the first of the nation's banking giants to report second-quarter earnings and its profit report is closely watched by analysts and investors as a proxy for the health of the economy. In particular, analysts are looking to see what impact rising interest rates and higher gas prices are having on consumer spending and defaults on consumer loans.

In the quarter, Citigroup's earnings were powered by strong growth from its big investment banking group, which posted a 26% gain in net income to $1.72 billion. Corporate and investment banking revenue jumped 31% to $6.76 billion.

It's not surprising that investment banking was strong at Citigroup, given that the market for bond offerings and advisory work on corporate deals has remained strong this year. Up until recently, the initial public offering market also had been going at full blast.

Consumer banking at Citigroup also posted solid numbers. Globally, the consumer group -- the single biggest division at the bank -- reported a 10% increase in net income to $3.18 billion. Revenue jumped 5% to $12.6 billion.

The bank's domestic consumer business, which showed signs of weakness in the first quarter, rebounded in the second quarter. Net income for the bank's U.S.-based consumer lending businesses rose 11% to $2.1 billion. Revenue, however, was largely unchanged, rising just 1% for the U.S. consumer group to $7.6 billion.

It wasn't all good news for the U.S. consumer business. Revenue from the bank's domestic credit-card business was flat at $3.25 billion. Revenue from domestic consumer lending, which includes mortgages, declined 5% to $1.3 billion.

The bank blamed much of the decline in traditional consumer lending on a drop in mortgage-servicing revenue and a compression of the bank's net interest margin -- a measure of the profitability of its lending and deposit operation.

Net interest margins at many banks have declined due to the narrowing of the spread between long- and short-term interest rates. The narrowing spread makes it difficult for banks to reinvest customer deposits into higher-earning investments.

Credit quality at Citigroup remained good in the quarter. The quarterly provision for loan losses actually fell by 17% in the quarter to $1.4 billion. On a sequential basis, the quarterly provision for loans going sour rose a modest 3%.