Is the U.S. now in a recession? It depends on whom you ask.

The rule of thumb is that two consecutive quarters of declining gross domestic product (GDP) qualifies as a recession. However, the official declaration of a recession must come from economists on the National Bureau of Economic Research committee.

One thing is for certain: The stock market performs dismally during recessionary periods. Does that mean you should stay away from stocks entirely? Nope. Some have what it takes to swim against the stream. Here's my top stock to buy if we're indeed in a recession.

Literally at the top

If you look up the word "vertex" in a dictionary, the definition will be something similar to "at the top." I think the top stock to buy if we're in a recession is literally at the top -- Vertex Pharmaceuticals (VRTX -0.80%).

The second word in Vertex's name gives away what business it's in, although technically it's a biotech rather than a pharmaceutical company. The two terms are often used interchangeably. However, there are a few differences between biotechs and pharma companies

Vertex's shares are also near their top historically. The biotech stock is only around 5% below its all-time high. Despite the abysmal performance of the stock market so far this year, Vertex's shares have soared nearly 30%.

But it's not Vertex's name or its high-flying share price that makes it a great pick if a recession has begun. There are more compelling reasons.

Checking off all the boxes

Simply put, Vertex checks off practically every box I can think of for what you'd want when buying a stock during a recession. Seriously -- every box.

Businesses that sell products that are must-haves and not merely nice-to-haves fare better during economic downturns. Vertex markets drugs that treat cystic fibrosis (CF). You can rest assured that physicians aren't going to quit prescribing the company's drugs because of a recession.

Even better, though, are businesses that don't have competition for their must-have products. Vertex meets this criterion as well. The company's four CF drugs are the only ones approved for treating the underlying cause of CF. Vertex's patents for its best-selling and most advanced CF drug provide protection through 2037. The nearest rivals are only in phase 2 testing -- putting them years away from even potentially competing against Vertex. 

Companies in excellent financial shape tend to hold up better during recessions as well. Vertex expects to generate around $8.5 billion in revenue this year. Based on the company's past track record, over 40% of that total will be profit. Vertex also has a big cash stockpile totaling $8.2 billion as of March 31, 2022. 

What about growth? Vertex's revenue jumped 22% year over year and its earnings rose 17% in Q1. The company should be able to continue delivering solid sales growth over the near term as its picks up additional reimbursement deals and regulatory approvals for its CF drugs.

Vertex also has a potential near-term catalyst. It expects to file later this year for regulatory approvals of exa-cel in treating (actually, curing) sickle cell disease and transfusion-dependent beta-thalassemia. 

The big biotech's long-term growth prospects look great, too. Vertex's pipeline features three other candidates either in or soon to be in late-stage studies.

There's an experimental triple-drug combo that could be Vertex's most powerful CF drug yet. VX-147 targets APOL1-mediated kidney disease, an indication with more patients than CF has. VX-548 is a non-opioid therapy that could be a game-changer in treating acute pain. Speaking of game-changers, Vertex also has an early stage program that holds the potential to cure type 1 diabetes.

Any weak links?

You might think that a stock that has as much going for it as Vertex does would be ridiculously expensive. That could make it riskier during a likely market downturn during a recession.

That's not the case with Vertex, though. Its price-to-earnings-to-growth (PEG) ratio is only 0.41. Any PEG ratio below 1.0 is considered to be an attractive valuation.

Probably the biggest weak link for Vertex is that one or more of its pipeline programs flop in clinical testing. The company has experienced some clinical setbacks in the past but not many. 

However, every stock comes with some risks. My view is that Vertex offers one of the most appealing risk-reward propositions to be found right now. And if we're entering a recession, I think there are few stocks in as strong of a position to deliver positive returns as Vertex.