Goldman Sachs posted earnings Tuesday that easily beat expectations on the top and bottom lines. The company also disclosed it plans to buy back $8.7 billion in shares after being "extensively engaged" with shareholders on the issues.

After rising during the premarket, shares fell at the market open and were last down about 1.5 percent.

The bank reported:

Earnings of $5.02 per share vs. $4.17 expected by Thomson Reuters.

Revenue of $8.33 billion vs. $7.54 billion expected.

Goldman on Monday declared a dividend of 75 cents a share; the firm also repurchased 9.6 million shares at a cost of $2.17 billion after repurchasing $6.1 billion in 2016. The company indicated that it has received regulatory permission to add another nickel to the dividend by the second quarter of 2018.

Goldman has struggled of late in some respects but particularly trading, where fixed income, currencies and commodities revenue plunged 40 percent in the second quarter. Investment and lending also have seen steep decreases this year.

However, the results for the third quarter helped allay some of those fears.

Fixed income trading revenue was $1.45 billion, against the $1.38 billion projected by FactSet. There was a 26 percent drop on bond trading, and chief financial officer Marty Chavez said commodities were on their way to the worst full-year performance since Goldman went public in 1999.

"Operating results were a beat to us driven by better revenues in all segments but investment management," analysts at Keefe, Bruyette & Woods said in a note. "Overall, GS posted solid results this quarter and the stock should do well with a rebound in revenue."

Also, investment banking revenue of $1.8 billion beat estimates of $1.63 billion, though equities trading revenue fell short of the mark at $1.67 billion against forecasts of $1.77 billion.

Equities securities represented another point of strength, increasing 51 percent to $1.39 billion.

Return on equity came to 10.9 percent for the year — 10.3 percent year to date — against the 10 percent cost of capital.

"Our overall performance this year has been solid and provides a good foundation on which to execute and deliver our growth initiatives," CEO Lloyd C. Blankfein said in a statement.

Traders initially reacted positively to the results, sending shares up as much as 1.4 percent in premarket trading. However, shares turned around shortly after the market open.

The stock has been a laggard this year, up just 1.2 percent year to date against the return of more than 14 percent and a rise of 3.4 percent for the SPDR S&P Bank ETF. Wall Street remains cool on the stock, with an average target price of $240.31 representing little change from the current level, according to FactSet.

Goldman said it has recorded net revenues of $24.24 billion so far in 2017, an increase of 8 percent over the same period a year ago. Debt underwriting has been a particular area of strength, generating $2.03 billion, the most ever for the bank.

Compensation levels remained steady at $3.17 billion while noncompensation expenses rose 4 percent annualized and 2 percent quarterly.

Earlier Tuesday, rival Morgan Stanley reported earnings that topped analysts' expectations.