Two big drugmakers have seen their stocks go in opposite directions over the last five years. GlaxoSmithKline (GSK 0.01%) shareholders lost more than 10% during the period, while Johnson & Johnson (JNJ -0.51%) shareholders have enjoyed gains of over 75%. Which of these pharmaceutical stocks is the better buy for investors now? Here's how Glaxo and J&J compare. 

Image source: Getty Images.

The case for GlaxoSmithKline

While it's been a tough few years for GlaxoSmithKline, better days could be ahead. The big drugmaker reported encouraging results in the third quarter of 2016, with sales up 8% and core earnings per share 12% higher using constant exchange rates.

Glaxo's HIV drugs Tivicay and Triumeq continue to be huge winners. The company's vaccines business also is performing very well. There are a few weaknesses in Glaxo's current product lineup, though. Most notable is that sales are falling for the company's top-selling drug, Seretide/Advair.  

The good news for GlaxoSmithKline, however, is that it has several strong new products and potentially more on the way. New drugs now account for a quarter of Glaxo's total pharmaceutical sales. The company hopes to soon win regulatory approval for shingles vaccine Shingrix and autoimmune disease drug sirukumab.

Glaxo's pipeline appears to be solid as well. The company expects key data for between 20 and 30 programs by the end of 2018.

You won't find too many healthcare stocks with higher dividend yields than GlaxoSmithKline. Its dividend yield currently stands at 4.75%. However, the company has been financing its dividend payments largely through increasing its debt. That can't continue indefinitely.

Earnings growth should be on the way for Glaxo, though, which will help the company keep the dividend payments flowing. Wall Street expects Glaxo to increase earnings over the next five years by an average annual rate of 11.7%.  

The case for Johnson & Johnson

While GlaxoSmithKline has struggled in recent years, Johnson & Johnson has flourished. If you only looked at the last quarterly performance for the two companies, though, J&J might seem to be a little behind Glaxo.

In the third quarter of 2016, Johnson & Johnson reported a year-over-year revenue increase of just over 4%. Earnings per share, however, grew by over 27% -- helped by significant share buybacks.

Johnson & Johnson's performance has been weighed down by lackluster results from its consumer and medical device segments. Its pharmaceuticals business has experienced solid growth, though, thanks in large part to skyrocketing sales for cancer drug Imbruvica. J&J is also seeing great performance from its immunology drugs, particularly Stelara, and cardiovascular drug Xarelto.

There's a lot to like in J&J's pipeline. The company awaits regulatory approvals for several drugs, including sirukumab (for which J&J is partnering with GlaxoSmithKline). J&J has a handful of cancer drug candidates that could become big winners, such as imetelstat (which Johnson & Johnson licensed from Geron) and niraparib (licensed from Tesaro).

Johnson & Johnson's dividend yield of 2.79% isn't as high as Glaxo's, but the company is only using a little over half of its earnings to cover the dividend. That leaves plenty of room for J&J to increase its dividends, something the company has done for 54 years in a row.

Wall Street analysts project that J&J will grow earnings by 6.5% annually over the next five years. That's not breathtaking growth, but it's only a little less than how much the company grew earnings over the past five years, a period in which the stock performed very well.

Better buy

GlaxoSmithKline appears to be turning a corner. My view, though, is that the better choice for long-term investors is Johnson & Johnson.

Although J&J's consumer and medical device segments aren't growing much right now, they are generating lots of cash for the company. Johnson & Johnson is in an excellent position to make acquisitions that could help it bolster its already-strong pipeline.

It's hard to beat J&J's track record of consistency for both steady earnings growth and dividend increases. Investors aren't likely to regret buying Johnson & Johnson stock.