But the bank said revenue rose 6 percent to $9.13 billion over the year, much better than the $7.97 billion analysts had expected, according to the data provider FactSet.
That was largely thanks to more companies paying Goldman to help them sell stocks and bonds and arrange their initial public offerings known. Goldman reported a record $1.28 billion in underwriting revenue, up 20 percent from the same period a year ago.
On a per-share basis, quarterly earnings were $4.10, handily beating analysts' forecasts of $3.05.
The news sent Goldman's stock up $1.88, or 1.2 percent, to $168.98 in early trading.
In a statement, Goldman's CEO said he was "pleased" with the results.
Lloyd Blankfein said a pickup in investment banking and investment management helped offset "less favorable conditions" for its institutional client unit.
The main way that Goldman makes money is by trading on behalf of institutional investors such as pension funds and hedge funds. Revenue from that trading sank 12 percent, much as analysts had forecast. Traders thrive when markets take dramatic turns up and down, but financial markets were relatively quiet from the start of April to the end of June.
In an effort to pare expenses, Goldman had been slashing pay over recent years, the bank's single biggest cost. In the second quarter, however, compensation was $3.9 billion, up 6 percent from the year before.
The bank's stock had slumped nearly 6 percent this year, making it the worst performer among the 30 big companies in the Dow Jones industrial average.