Analysts had been anticipating a fairly decent quarter for Goldman, and its results were buoyed by strong trading and investment banking results and lower compensation costs. In the fourth quarter of 2011, the bank earned $1.84 a share.

The bank’s most recent results reflect a continued focus on cutting expenses as well as a number of investing gains, including $485 million from debt and security loans, the company said.

The results had an immediate effect on the company’s stock, which closed 4 percent higher at $141.09 on Wednesday.