Merck (MRK -0.33%) has performed poorly in the stock market this year, with the drugmaker's shares down by 5%. But zooming out helps put a different spin on this story as the pharmaceutical giant has easily crushed the broad equity indexes over the past 12 months.

Perhaps Merck is dealing with temporary headwinds and will return to its market-beating ways soon. Or is the company facing severe problems that will continue to harm its stock price? Let's find out whether it's worth buying shares of Merck today.

MRK Chart

MRK data by YCharts

Keytruda continues to lead the way 

Merck is particularly known for its oncology business and specifically for its blockbuster cancer drug, Keytruda. This medicine has been responsible for much of Merck's growth for years now, and that shows little signs of stopping. In the second quarter, Keytruda's revenue of $6.3 billion increased 19% year over year. Keytruda was responsible for about 42% of Merck's revenue.

What makes this cancer treatment so special is that it is essentially a pipeline in a drug. Keytruda has earned over 40 approvals in the U.S. alone -- an impressive number -- and countless more in other countries. It is indicated to treat a range of cancers, including liver, head and neck, bladder, and more. Keytruda will likely become the world's best-selling drug this year following the loss of patent exclusivity of AbbVie's Humira.

The oncology product should hold on to that title through 2028, according to research firm Evaluate Pharma. In other words, there remains a bright future ahead for this medicine, which is still being investigated in plenty of clinical studies. Still, there are other products in Merck's arsenal. In the second quarter, the company's HPV vaccines, Gardasil and Gardasil 9, registered combined sales of $2.5 billion, up 47% year over year.

Merck's other cancer medicines, Lynparza and Lenvima, also had a decent quarter. It's true that the drugmaker's revenue only increased by 3% year over year, but that was due to its coronavirus medicine, Lagevrio, seeing its sales plummet as expected. Excluding Lagevrio, Merck's revenue increased by 11% year over year -- a solid performance for a pharma giant.

Merck reported a rare net loss during the period, but that was due to its recent acquisition of immunology specialist Prometheus Biosciences for $10.8 billion in cash.

What does the future hold?

Merck's unimpressive or nonexistent revenue growth (its top line declined in the first quarter) may be one of the reasons behind the company's poor stock market performance so far this year. And another thing that always hovers above Merck's head is its heavy reliance on Keytruda. What will happen once it runs out of patent exclusivity in 2028 and has to face biosimilar competition?

Unless Merck can find ways to recoup the inevitable losses this event will trigger, the company's shares aren't worth buying right now. Fortunately, the company is working on precisely that. First, a subcutaneous formulation of Keytruda that's in the works could help extend its patent exclusivity. 

Second, that's also why Merck turned to acquisitions. Its recent buyout of Prometheus helped it get its hands on several promising programs in the field of immunology. That includes Prometheus' leading candidate, PRA-023 (now known as MK-7240), which is being developed to treat ulcerative colitis, Crohn's disease, and more.

Merck could follow that deal with even more acquisitions. In the company's second-quarter earnings conference call, CEO Rob Davis said in response to a question about further mergers and acquisitions:

We continue to have a priority to do business development. So, you should not necessarily expect a slowdown. If and when assets that bring important scientific opportunities present themselves, where we see an alignment with strategy and where we can see value creation, we have the capacity, and we will be and are willing to act on those. So, we're actively looking, and we'll continue to drive deals because while I feel very good about where we are, we're talking about trying to build a sustainable engine well into the next decade.

Merck, of course, has a portfolio of pipeline programs it will continue to work on, too. The company is running dozens of clinical trials, most of which are for internally developed clinical compounds. However, additional acquisitions could help Merck diversify its revenue base away from Keytruda and prepare for its eventual patent cliff.

Further, Merck also has an animal business, one of the largest around. While this unit hasn't been performing as well in the past couple of years, the increase in the number of pets and the growing need for protein from livestock present excellent long-term opportunities for Merck here.

Lastly, Merck is an excellent dividend stock that currently offers a yield of 2.78% and has increased its payouts by 52% in the past five years. Overall, Merck's business looks solid and can reward patient investors with steady returns and growing dividends for a long time.