Will there be a recession in 2023? Quite a few experts think so. But that doesn't mean great investing opportunities can't be found.

We asked three Motley Fool contributors to identify smart stocks to buy if a recession is indeed on the way. Here's why they picked Gilead Sciences (GILD 0.12%), Johnson & Johnson (JNJ 0.29%), and Vertex Pharmaceuticals (VRTX 1.25%)

A great combo for investors

David Jagielski (Gilead Sciences): Investors can minimize their risk in the event of a recession by investing in businesses that provide essential products and services and that also pay a dividend to help offset declines in the event of dropping share prices. Gilead Sciences meets both of those criteria, as its HIV treatments are vital to patients. The company has been growing its oncology sales as well.

When Gilead last reported earnings in October, its revenue from HIV products was up 7% year over year, coming in at just under $4.5 billion for the period ending Sept. 30, 2022. Oncology revenue of $578 million was also up an impressive 79% with Gilead noting strong demand for cancer-fighting drug Trodelvy. 

The company also increased its guidance, now expecting that its earnings per share will come in between $3.35 and $3.55 for full-year 2022, up from a previous range of $2.90 and $3.30. Gilead's earnings would be even higher if not for the company incurring in-process research and development expenses totaling $448 million in the most recent quarter. Those expenses are nonrecurring, however, and are primarily a result of the company's recent acquisition of MiroBio.

That's an important context to note, as investors may be worried about Gilead's dividend with its payout ratio seemingly unsustainable at 110%. But without those nonrecurring expenses, that ratio would be much lower. Gilead has only been paying out 41% of the free cash flow it has generated over the past four quarters as dividends. The stock's 3.4% dividend yield remains safe today. Gilead could also soon boost its dividend

Overall, Gilead should be a solid investment to hang on to whether you're buying it for safety this year or planning to keep it for the long haul as the business continues to grow.

This company is built to survive any recession 

Prosper Junior Bakiny (Johnson & Johnson): In times of economic downturns, consumers tend to rein in spending, which results in lower revenue and earnings for businesses. To survive or thrive during a recession, a company must be in a strong financial position or offer products people can't do without. Both of these criteria apply to Johnson & Johnson. 

The company develops and markets lifesaving drugs in several therapeutic areas, from oncology to immunology and neuroscience, among others. Johnson & Johnson is also a leading medical device company, and the products it sells within its medtech division are invaluable to healthcare facilities and physicians. Doctors won't stop prescribing medicines in times of a recession, and that is the last thing patients will want to save on. 

Further, Johnson & Johnson generates consistent revenue and profits. Even if its financial results were to suffer somewhat during an economic downturn, the company can handle its short-term obligations. Johnson & Johnson boasts an AAA credit rating from Standard & Poor's, the highest rating available. Investors won't see Johnson & Johnson defaulting on any of its debt anytime soon. 

Here's one more reason to buy the company's stock in case a recession is coming: the dividend. As a Dividend King, Johnson & Johnson has raised its payouts for an impressive 60 consecutive years. Dividends can help smooth out investors' losses if the market drops during a recession, and in the long run, they contribute substantially to total returns for those who opt for dividend reinvestment. 

Johnson & Johnson's solid dividend profile coupled with its excellent financial position can help it navigate the next recession and deliver solid returns long after. 

Monopoly money

Keith Speights (Vertex Pharmaceuticals): Unlike Gilead and Johnson & Johnson, Vertex Pharmaceuticals doesn't pay a dividend. However, I think this biotech stock is a great pick to weather a recession if one is on the way.

Importantly, Vertex stock performed quite well over the past 12 months with investors worried about the economy. Its shares have soared more than 30%. I think the good times will keep rolling.

Vertex is practically a money machine thanks to its monopoly in treating the underlying cause of cystic fibrosis (CF). The company will likely report 2022 revenue in the ballpark of $8.9 billion in its next quarterly update in February. You can expect around 38% of that total to flow down to the bottom line. 

This CF franchise will almost certainly generate even greater sales for Vertex in 2023. But there could be even better news on the way. The company and its partner, CRISPR Therapeutics, hope to win regulatory approvals for exa-cel in treating sickle cell disease and beta-thalassemia later this year. If approved, exa-cel will be the first CRISPR gene-editing therapy on the market. Vertex thinks the drug has a multibillion-dollar opportunity. 

Another late-stage program could reach the market in the near future as well. Vertex is highly optimistic about the prospects for its non-opioid acute pain drug VX-548. And again, the company sees a huge market opportunity in the billions of dollars. 

Vertex's approved drugs will enjoy consistent demand regardless of what happens with the economy. Positive news for exa-cel and VX-548 could provide solid catalysts for the biotech stock. I think that Vertex is basically a recession-proof stock to buy and hold for years to come.