When one thinks of prestigious, white-shoe, Wall Street investment banks, Goldman Sachs (GS 1.79%) and Morgan Stanley (MS 0.29%) are often the first two firms that come to mind. Goldman Sachs has roots that date back to 1869, while Morgan Stanley opened its doors in 1935.

They've been around a long time and remain two of the largest and most successful financial services institutions in the world. But given the difficult environment for investment banking, the last two years have been a struggle. Are these titans still buys -- and if so, which one is the better investment right now?

Head-to-head comparison

Goldman Sachs and Morgan Stanley are two of the three largest investment banks, along with JPMorgan Chase, by just about every measure, whether that is revenue, number of deals, or some other metric.

These stocks both soared in 2021, a record year for investment banking deals in a market buoyed by low interest rates and government stimulus. Then the bottom fell out in 2022 as inflation spiked, interest rates climbed, pandemic economic support ended, and the market tanked, causing deals to dry up. This year has been slightly better, but certainly less than ideal.

In the second quarter, Morgan Stanley saw about a 7% year-over-year revenue decline in its Institutional Services business, which includes investment banking, to about $5.7 billion. That accounted for about 42% of its overall revenue of $13.5 billion in the quarter.

Goldman Sachs was the worldwide leader in deals in the second quarter, generating $7.2 billion in revenue in its Global Banking and Markets business, a 14% drop year over year. The investment banking business generated about 67% of Goldman Sach's $10.9 billion in revenue in the quarter. Most of the rest of its revenue comes from Asset and Wealth Management, which generated $3.1 billion in the quarter, down 4% year over year.

On the bottom line, Morgan Stanley had net income of $2.2 billion in Q2, down 13% from the same quarter a year ago, while Goldman Sachs saw net earnings plummet 58% year over year to $1.2 billion.

The quarter highlighted the key advantages that Morgan Stanley has over Goldman Sachs, which is that it is less reliant on investment banking. In fact, investment banking is not even Morgan Stanley's largest revenue generator -- that would be its Wealth Management business, which includes E*Trade, Morgan Stanley Financial Advisor services, and its investment management arm.

Morgan Stanley had a record $6.7 billion in revenue in the quarter in this business, up 17% year over year, bringing in some $90 billion in net new client assets.

As a market leader in this business, Morgan Stanley has a more diversified revenue stream than Goldman Sachs, with wealth management providing nice balance when investment banking is down.

Which is the better buy?

Another similarity between these two companies is they both increased their dividends in the third quarter. Goldman Sachs hiked its payout 10% to $2.75 per share for a yield of 3.2% and a payout ratio of 43%. Goldman Sachs has increased its dividend for 11 straight years.

Morgan Stanley also boosted its dividend 10% in the quarter, up to $0.85 per share. It has a yield of 3.9% with a payout ratio of 53%. Morgan Stanley has increased its dividend for nine consecutive years.

MS Chart

Data source: YCharts

The valuations of both of these firms have come up over the past year, and each has a price-to-earnings (P/E) ratio in the 14 to 15 range, which is a pretty fair number in both cases.

I think they are both buys at this level, because investment banking has shown signs of waking up and the market is predicted to be stronger still in 2024. Both of these stocks will surge higher if that happens.

But if I had to pick one, it would be Morgan Stanley, because of its more balanced revenue mix and its market leadership in two different areas. That strength and balance have enabled it to outperform Goldman Sachs over the years, as the chart above shows, and I expect it to be the better long-term performer for the same reasons.