The stocks of big pharmaceutical companies are usually not very exciting, but that's just fine for savvy investors who value safe dividends and the fact that these stocks often outperform the market in downturns. GlaxoSmithKline (NYSE:GSK) and Johnson & Johnson (NYSE:JNJ) are both diversified healthcare companies, and the one that's the best pick for you may depend on the kind of investor you are.

The case for GlaxoSmithKline

Glaxo's business has strengthened since the closure two years ago of an asset-swap deal with Novartis. Some observers were critical of the deal at the time, as the company traded its fast-growing and profitable oncology drugs for more pedestrian vaccine and consumer-goods assets.

A fork in a country road, with the sun low in the sky.

Image source: Getty Images.

But the deal added stability and balance to the company, yielded $5 billion in annual cost savings, and left the company with cash proceeds of $16 billion to invest in new product development that has reinvigorated the pharma segment. Sales of drugs that have been developed in the most recent three or four years have increased from $687 million in Q2 of 2015 to $1.8 billion in the most recent quarter. Pharmaceutical sales in Q1 were 57% of the total, vaccines 16%, and consumer 28%.

All three business segments are contributing well, with each reporting positive growth for four consecutive quarters on a constant currency basis. Vaccines have been the growth leader recently, with a 12% increase in sales in 2016 and a 16% pop in Q1 of 2017. Overall, Glaxo was able to grow the top line by 6% and earnings per share by 12% last year.

This year will be a little bit more challenging, mainly because of the generic threat to its biggest drug, Advair. The respiratory drug sold $3.5 billion in 2016, but the company has said that if a generic shows up around mid-year, sales in the U.S. could be expected to drop by $1.2 billion. In that scenario, 2017 EPS could be flat to slightly down from 2016. Given Mylan's recent stumble in its attempt to win approval for its Advair generic, this is probably the worst case.

But outside of Advair, Glaxo's pharma business is quite healthy. Notable is the growth in its HIV drugs, which are giving Gilead Sciences a run for its money. The HIV portfolio grew 19% in constant currency last quarter to almost $1 billion. 

Meanwhile, Glaxo continues to pay a generous dividend that amounts to 4.9% at today's exchange rate. Improving free cash flow in recent quarters seems to indicate the company will have no problem paying its dividend going forward.

The case for Johnson & Johnson

Johnson & Johnson is already what GlaxoSmithKline has aspired to become: well balanced across multiple businesses and not as susceptible to the ups and downs of pharmaceutical sales. J&J's drug business comprises 45% of total sales, medical devices 32%, and consumer 20%.

J&J has been challenged to generate the growth that investors would like to see in recent years. Sales in 2016 increased 2.6% after declining 5.7% in 2015. But improving margin in the consumer business has helped prop up earnings gains, with adjusted EPS growing 9.7% last year. The overall business has generated plenty of cash, giving J&J the option to grow by acquisition.

And acquire it did, picking up Swiss pharmaceutical company Actelion in a $30 billion cash deal announced in January. Management expects the deal to add 1.5% to 2% to the company's long-term growth rate, and an additional $0.35 to $0.40 in earnings per share to 2018 results. The ability to do this kind of deal illustrates the advantages of the financial strength resulting from J&J's size and diverse revenue base.

Even without the Actelion transaction, Johnson & Johnson was expecting to see improving growth. The medical-devices unit made three smaller acquisitions, and the company projected organic sales growth in the 3% to 3.5% range. Guidance for adjusted earnings growth for 2017 excluding currency is 5.8% to 8%. 

But from an investor standpoint, the most appealing characteristic of Johnson & Johnson stock has long been the dividend. The company has raised its dividend annually for over 50 years, and over the past 10 years the payout has grown at a compounded annual rate of 9.4%. The current forward yield is 2.7%.

Even without gangbusters growth, the company has enriched its shareholders by delivering total returns of 10.5% annualized over 20 years, soundly beating the S&P 500's return of 7.7% over that period. The difference for a person who invested $10,000 in J&J 20 years ago and reinvested dividends would be a profit of $63,662 vs. $34,087 if invested in the index. Johnson & Johnson is the tortoise that wins a lot of races.

Better buy

I'm going to give a nuanced answer to this choice. For a conservative investor who wants to put money in an income stock, reinvest dividends, and forget about the investment for a decade or more, it would be hard to go wrong picking Johnson & Johnson. The company has demonstrated a commitment to shareholder returns and has the management, product portfolio, and financial strength to continue to deliver compounding, market-beating returns for a long time.

On the other hand, I think GlaxoSmithKline is likely to deliver a higher total return over the next five years. The yield of 4.9% is abnormally high, probably because the company doesn't have a long history of sufficient coverage of the dividend out of profits and cash flow to give investors confidence that it can be maintained for the long run.

I think it will be. Glaxo's restructuring efforts have paid off with a much stronger free cash flow, and as it becomes more evident, the stock will rise to bring the yield down to a level more consistent with its peers. A yield of 3.5%, for example, would imply a stock price of about $59 at the current dividend rate, about 41% above today's level.

Also, there is a good chance that Glaxo's growth over the next five years will exceed that of Johnson & Johnson. The threat to Advair is well priced into the stock at this point, and once that issue fades in the rearview mirror, growth in its other assets will take over and could even support a higher multiple.

Which stock is a better buy for you depends on your goals and temperament. Either one could potentially give you market-beating returns.

Jim Crumly owns shares of Gilead Sciences and Johnson & Johnson. The Motley Fool owns shares of and recommends Gilead Sciences and Johnson & Johnson. The Motley Fool has the following options: short June 2017 $70 calls on Gilead Sciences. The Motley Fool recommends Mylan. The Motley Fool has a disclosure policy.