Profit was $1.9 billion after payments to preferred shareholders, compared with $927 million a year ago.
Per share, those profits were $3.70. Analysts polled by FactSet had expected $2.83.
Revenue was $8.6 billion, up 30 percent from $6.6 billion a year ago. That also beat the expectations of analysts, who had forecast $8 billion.
In a statement, CEO Lloyd Blankfein called the quarter "solid," especially considering the "mixed economic sentiment."
Blankfein described the U.S. economy as improving, but said that Goldman would "continue to put a premium on disciplined risk management."
One way that Goldman makes money is from trading on behalf of institutional clients like pension funds and hedge funds. Revenue from the unit that trades on behalf of clients was up 11 percent.
Goldman said that market conditions became "more challenging" during the latter part of the second quarter "as interest rates and market volatility increased."
The stock market zig-zagged and bond prices fell in late May and through most of June because investors were trying to guess how long the Federal Reserve will continue its economic stimulus program. Goldman's revenue from trading mortgages and interest-rate products fell, though higher stock market values and increased activity in Asia helped the bank's stock-trading business.
Even with the fitful quarter, conditions were still calmer than in the year-ago period, when worries about Europe's debt woes were much more acute and Washington was deadlocked over budget issues. Besides, many investors see volatility as a reason to get into markets because there are more opportunities to trade.
The biggest increase in Goldman's earnings came from underwriting stocks and bonds, where revenue soared 45 percent.
The bank said it set aside more money for potential lawsuits and regulatory proceedings, but didn't give details. A former Goldman Sachs trader, Fabrice Tourre, went to trial Monday in New York, accused of selling mortgage-backed securities that he knew were going to fail. Goldman already settled related charged with the Securities and Exchange Commission in 2010, though it still faces private lawsuits.
Goldman's stock rose $1.52, or 1 percent, in pre-market trading to $164.52.