The bank's stock was up 0.7 percent at $168.17 on Tuesday morning on the New York Stock Exchange.

Goldman posted net income for shareholders of $1.95 billion, or $4.10 per share, in the three months ended June 30, up from $1.86 billion or $3.70 per share in the same period a year earlier.

Analysts on average had expected earnings of $3.05 per share, according to Thomson Reuters I/B/E/S.

Institutional investors have been shying away from the bond market because of a lack of strong opinions about interest rates and currency moves.

Rival banks Citigroup Inc C.N and JPMorgan Chase & Co JPM.N said a pickup in trading volume in June helped offset slowness in April and May.

"The sustainability of that trend is in question," said Brian Kleinhanzl, a research analyst at Keefe, Bruyette & Woods who rates Goldman a "market perform."

JPMorgan said on Tuesday that the June improvement in bond trading has not carried over to July.

Goldman's net revenue from fixed-income, currency and commodity trading for customers, known as FICC, fell 10 percent to $2.22 billion.

Analysts had expected a bigger decline. Bernstein Research analyst Brad Hintz had estimated $1.8 billion in fixed-income trading revenue for the quarter.

In May, JPMorgan Chase & Co and Citigroup forecasted declines in overall trading revenue closer to 20 percent for the second quarter, compared with the same period last year.

Goldman's net revenue in its investing and lending division jumped 46 percent to $2.07 billion. This included net gains of $1.25 billion from investments in equities.

The bank was also helped by better results in investment banking, where it ranked No. 1 in mergers and acquisitions, as well as equity underwriting, for the first half of 2014, according to Thomson Reuters data.

In equity underwriting, the bank's revenue rose 47 percent to $545 million, helped by Goldman's work on deals including the initial public offering of Ally Financial. ALLY.N

Investment banking revenue overall, which includes M&A, debt underwriting and stock underwriting, rose 15 percent to $1.78 billion.

Goldman executives often say that investment banking is the center of its broader franchise, because those clients also generate revenue for its trading, investment management and lending businesses.

The bank makes most of its money from trading and investing in capital markets. This sets it apart from JPMorgan Chase & Co, Citigroup and Bank of America Corp BAC.N, which have big consumer and corporate lending businesses.

JPMorgan, the biggest U.S. bank by assets, on Tuesday reported an 8 percent decline in second-quarter profit as a pullback in trading of bonds and currencies by big institutions hit revenue in its securities trading business.

On Monday, Citigroup reported a 16 percent drop in trading revenue.

(Reporting by Anil D'Silva in Bangalore and Lauren Tara LaCapra in New York; editing by Saumyadeb Chakrabarty, Dan Wilchins, and Matthew Lewis)

By Anil D'Silva and Lauren Tara LaCapra