If you owned shares of either Johnson & Johnson (NYSE:JNJ) or Merck (NYSE:MRK) over the last five years, you're likely a happy camper. Both stocks are up more than 75% during the period. Both have also seen their shares climb by double-digit percentages this year, with Merck outperforming J&J by around 5%. Which is the better choice for investors looking at 2017 and beyond? Here's how J&J and Merck stack up.

Image source: Getty Images.

The case for Johnson & Johnson

In a sense, Johnson & Johnson is three companies rolled into one. The healthcare giant's three business segments -- consumer, pharmaceutical, and medical devices -- are all multi-billion dollar enterprises.

The best investing case for J&J comes from its pharmaceutical segment. Sales for the segment grew over 9% in the first three quarters of 2016. The company claims several products boasting solid year-over-year sales increases, notably including anti-inflammatory drugs Simponi and Stelara, HIV drug Edurant, and blood thinner Xarelto.

Johnson & Johnson's biggest success story right now, though, is cancer drug Imbruvica. Third-quarter sales nearly doubled the amount generated in the prior year period. The future also looks promising for Imbruvica: The drug is currently in half a dozen late-stage clinical studies targeting additional indications.

That's just the tip of the iceberg. J&J's pipeline includes 28 late-stage programs. This count doesn't include rheumatoid arthritis drug sirukumab, which is awaiting regulatory approval in the U.S. and Europe. 

Dividend-seeking investors really have a lot to like about Johnson & Johnson. The dividend yield currently stands at 2.7%. J&J has increased the dividend for 54 consecutive years.

The company hasn't been a slouch at growth, either, posting 32 consecutive years of adjusted earnings increases. With a solid lineup featuring Imbruvica plus over $40 billion in cash, cash equivalents, and marketable securities that could fund further acquisitions, Johnson & Johnson should be able to keep its growth streak going.

The case for Merck

Merck also has its own rising star with Keytruda. Sales for the cancer drug totaled $919 million. That's just the start. Analysts expect Keytruda to reach peak annual sales of over $8 billion.

The company also continues to see solid growth from its vaccines franchise. Sales for human papillomavirus (HPV) vaccine Gardasil and its ProQuad/M-M-R II/Varivax vaccines increased by double-digit percentages in the first nine months of 2016 compared to the prior year period. In addition, new hepatitis C drug Zepatier has contributed significant revenue this year.

Merck does face some challenges. Cardiovascular drugs Zetia and Vytorin lose patent protection in 2017. An agreement actually allows a generic version of Zetia to launch even sooner -- in December 2016. 

Several pipeline candidates could help boost sales in the future. Merck's pipeline includes 21 late-stage programs. Anacetrapib, which targets treatment of atherosclerosis, could run into trouble since two chemically similar drugs failed to win regulatory approval. However, Merck has multiple Keytruda studies in additional indications plus several diabetes candidates in late-stage development, along with experimental Alzheimer's disease treatment verubecestat.  

Thanks largely to Keytruda and other possible winners in the pipeline, Wall Street thinks that Merck will be able to grow annual earnings by around 6% over the next five years. That's close to the same level expected for Johnson & Johnson. 

Merck's dividend yield of almost 2.9% is a tad higher than Johnson & Johnson's. However, the company uses more of its earnings to fund dividend payments than J&J does. Also, Merck can't boast of the string of annual dividend increases like J&J can.

Better buy

Merck should be a pretty good choice for investors looking for a reasonable dividend yield. Keytruda will likely become one of the biggest-selling drugs on the market, fueling Merck's growth well into the future.

However, I think Johnson & Johnson is the better pick for long-term investors. J&J provides consistency combined with a solid potential for steady (if not spectacular) growth. My take is that investors will continue to be happy campers with either one of these stocks, but J&J shareholders will probably have the bigger smiles a decade or more from now.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.