Johnson & Johnson (JNJ -1.15%) and Merck & Co. (MRK 2.93%) are two heavyweights in the pharmaceutical sector. Both companies generate billions in sales and profits and have developed many successful drugs over the years.

However, both underperformed in 2019. Merck's 19% return last year was well above the 13% that Johnson & Johnson produced for its investors, but shares of both companies still fell well shy of the 30% return enjoyed by the S&P 500.

Deciding which stock is the better buy today is no easy task. Both offer investors some great opportunities in healthcare, and there's not a whole lot separating the two. Let's take a closer look at the two stocks to see which one has the edge today.

Is J&J worth the risk?

By looking at its financials, J&J looks to be a solid stock. Sales of $20 billion in each of the last four quarters, accompanied with profits of at least $3 billion during that time, make the stock appear to be a very good buy. The company has even achieved modest growth in its most recent quarter, with sales climbing by 1.9%.  

Its global reach and wide range of products and services that cover consumer, pharmaceutical, and medical devices, make the stock an appealing option for long-term investors as it offers a lot of diversification.

Pills spilled out from a bottle.

IMAGE SOURCE: GETTY IMAGES.

The problem with investing in J&J is the danger the stock faces from a legal perspective.

It's already faced multiple lawsuits, with its talc powder issue being one of its more high-profile concerns today. In November, the company lost a lawsuit relating to its vaginal mesh products in Australia. Oklahoma also went after J&J for the company's role in opioid-related deaths in the state – and it won. It sets a troubling precedent for the company, should other states follow suit.

Overall, the stock has good fundamentals today, and it's in a good position to handle these lawsuits with $18 billion in cash on its books and the company continuing to generate positive free cash flow. However, if the fines and lawsuits keep coming, it could put in a dent in not only the company's cash but its image as well.

Merck is a safer option, but it may not be diversified enough

Merck also has strong financials – without the same risks that J&J is facing today.

Over the past four quarters, its numbers are a bit more modest, with profits ranging from $1.8 billion to $2.9 billion, and revenue typically hovering around $11 billion to $12 billion. However, it's also avoided the bad press that J&J has endured over the years, which could make it a much safer and more predictable investment.

The company got some great news this month from the Food and Drug Administration (FDA) after it approved Keytruda for use in a specific type of bladder cancer for patients who have not had success with other treatment options.

Keytruda is already an important part of Merck's sales, as the cancer-fighting drug also treats patients with other types of cancers as well.

In the company's third-quarter results released in October, Keytruda's sales were up 63% from the prior-year quarter, reaching $3.1 billion. The $1.2 billion increase in the drug's sales from a year ago was the main driver behind the company's overall improvement, as Merck's top line increased by just $1.6 billion during the quarter.

As valuable as Keytruda is, the danger for Merck is that it may be too dependent on this one blockbuster.

Why Merck is the better buy

There's not a lot separating these two stocks. While Merck may be smaller than J&J, it's by no means worse for it.

Both stocks have good numbers and both trade at a forward price-to-earnings ratio of 16. Merck offers slightly better value when factoring in analyst expectations of growth, as its PEG ratio of 1.7 is lower than J&J's, which comes in at 2.9. 

Merck also offers a slightly higher dividend yield of 2.7%, versus the 2.6% that J&J pays. While J&J has a stronger track record when it comes to increasing dividend payments and is a Dividend Aristocrat, that's not enough to tip the scales in its favor.

Overall, with a slight advantage in valuation and fewer risks facing the company, Merck is the better healthcare stock for investors today.