The U.S. and countries worldwide have been experiencing a growing chorus of recession calls in 2022. Accordingly, the S&P 500 index is down 19% this year. On the other hand, Merck (MRK -0.08%) is up 20% year to date and Pfizer (PFE 1.04%) is down only 13%. Both outperformed the index while inflation remains at multi-decade highs.

As investors contemplate the likelihood of consumers tightening their purse strings, certain sectors are getting hit harder than others. For instance, the S&P Retail Select Industry Index tracks discretionary consumer stocks in the S&P 500. The index is down 28% this year. Additionally, the S&P Semiconductor Select Industry Index, which is down 30% in 2022, tracks stocks supplying consumer electronics companies.

If inflation persists and countries around the globe enter a recessionary period, consumers could forgo spending on retail and electronics. However, medicine is not something people can pass on to save money. Private or government insurance programs often pay pharmaceuticals, usually making out-of-pocket expenses manageable. Here's why Pfizer and Merck could continue to outperform in a recession.

Medicine spilling out of a bottle next to a stethoscope.

Image source: Getty Images.

1. Pfizer

The company has a wide-ranging portfolio of biopharma drugs that treat breast, prostate, and skin cancers. Most of the medicines in Pfizer's oncology portfolio are steadily growing in revenue and profits due to their patent protection. Gross margin for the company's biopharma portfolio has increased from  20% in 2019 to 38% in 2021.

Much of the gross margin improvement in 2021 came from Pfizer's COVID-19 vaccine. Though many investors believe that the COVID vaccine sales will fall off in years to come, it won't likely be this year. Pfizer anticipates revenue from the vaccine will reach $32 billion in 2022. Pfizer's COVID treatment, Paxlovid should add another $22 billion.

The patent protection afforded to pharma companies like Pfizer allows them to profit from the drugs until they expire. Several of Pfizer's major drugs are protected for the next three to five years, giving the company time to earn excess profits while the recession story plays out. Investors' fear of Pfizer's patent expirations could explain the stock's 13% decline this year.

To address the expirations, Pfizer is plowing massive profits from its COVID-19 vaccine and oral treatment into acquisitions. The company has already closed deals to buy Arena Pharmaceuticals and ReViral. It has also agreed to buy Biohaven Pharmaceuticals (BHVN -5.12%). Pfizer plans to continue to make acquisitions with cash on hand and future earnings. The company's drug pipeline and acquisitions could provide continued profits and extend the patent protection of its overall drug portfolio in the event of a recession. 

2. Merck

Merck's growing drug portfolio includes therapies for cervical cancer, acute hospital care, and Type 2 diabetes. It also includes vaccines for HPV, chickenpox, and a single vaccine for measles, mumps, and rubella. Its animal health drugs have also provided Merck with a growing source of income.

In its first-quarter earnings report, Merck announced a 50% increase in total sales. The top-line jump was aided by its COVID-19 treatment. Outlier growth in the treatment is not expected to continue, but worldwide revenue growth was 18% in the first quarter after excluding it.

Management also raised its full-year revenue guidance from $56.9 billion to $58.1 billion. In addition, it estimates full-year adjusted earnings per share to be between $7.24 and $7.36, up from $5.37 in 2021. Beyond 2022, analysts estimate earnings per share to grow to $8.85 in 2025. The global economic outlook is not quite as rosy.

And there are dividends

The two stocks could be great candidates to outperform during a potential global recession, and they also pay handsome dividends. Pfizer's dividend yield tops 3%, while Merck's clocks in at just under 3%. Ultimately both dividend yields top the S&P 500's of 1.7%. Investors fearing the worst may find shelter in these two pharma stocks.