Although the market is having the worst year investors have seen in a long time, some corporations are doing just fine. One of them is Merck (MRK 1.71%). The pharmaceutical giant is currently defying gravity; its shares are up by 31% since early January. The drugmaker has several things going its way, and there is a good chance that it will continue performing well no matter what happens to the stock market or the economy. Here's why Merck is an excellent stock for investors focused on the long game.

The gift that keeps on giving 

Like most large pharmaceutical companies, Merck has a lineup of medicines that continues to help it grow its top and bottom lines. During the third quarter, the company's revenue increased by 14% year over year to about $15 billion. Merck's adjusted net income for the period was $4.7 billion, 4% higher than the third quarter of 2021.

Merck's key asset remains its cancer drug Keytruda, which has racked up plenty of approvals. Keytruda's sales increased by 20% year over year in the third quarter to $5.4 billion, making up a little over a third of the company's entire top line. While relying too much on one product can be a red flag for drugmakers, Merck will be just fine.

Keytruda will not lose patent exclusivity until 2028, giving Merck enough time to replace it. Meanwhile, the cancer drug is still progressing on the clinical and regulatory fronts. It is undergoing several clinical trials that could help it earn more label expansions, and it won four new approvals in Japan in the third quarter.

What's more, Merck has a subcutaneous formulation of Keytruda in the works, which, if approved, would help the company extend its patent protection.The cancer medicine will continue to grow its sales until 2028. In fact, it is projected to become the top-selling drug in the pharmaceutical industry by 2026, taking that title away from rheumatoid arthritis medicine Humira.

In short, Keytruda will continue to be a significant growth driver for Merck for at least half a decade. 

Other avenues for growth

Merck's business extends well beyond Keytruda. The company markets other oncology products and various vaccines, and it is one of the leaders in animal health. Merck shares the rights to cancer medicine Lynparza with U.K.-based AstraZeneca. In the third quarter, Merck's revenue from this drug increased by 16% year over year to $284 million.

The bulk of Merck's pipeline programs is in oncology. The company plans to deliver over 80 new approvals within this therapeutic area by 2028. Meanwhile, Merck's HPV vaccines, Gardasil and Gardasil 9, are still growing their sales at a good clip. Combined revenue from these two products jumped by 15% year over year to $2.3 billion in the third quarter.

Last year, Merck expanded its vaccine portfolio thanks to the approval of pneumococcal vaccine Vaxneuvance. Some analysts predict that this product could eventually generate over $1 billion in annual sales. Merck's animal health business isn't doing so well, with sales dropping by 3% year over year to $1.4 billion in the third quarter, although they increased by 4% in constant currency terms.

However, with pet ownership growing, the animal health market will continue to expand, benefiting companies like Merck. Long-term trends such as the world's aging population will positively impact Merck's pharmaceutical business, too. And beyond its solid oncology lineup, the drugmaker boasts plenty of other candidates in various therapeutic areas, including diabetes, neuroscience, and infectious diseases. 

Merck will likely continue to perform well even if there is a recession. Physicians won't stop prescribing medicines amid an economic downturn. And the company has the tools to perform well in the long run thanks to its strong lineup and pipeline. Merck has the tools to reward shareholders for the remainder of this market downturn and beyond.