The S&P 500 index has been pushed into bear-market territory and now trades down roughly 21% year to date. Unfortunately, it's not just a matter of wavering investor confidence. The actual economy has weakened as well. 

U.S. gross domestic product (GDP) unexpectedly fell 1.6% in this year's first quarter, and recently released data modeling from the Atlanta Federal Reserve estimates that the country's GDP contracted 1% in the recently completed second quarter. If so, that means the economy will have notched two consecutive quarters in decline and likely have entered a recession.  

As such, the stock market may continue to struggle in the near term. However, a panel of Fool.com contributors has identified three investment candidates that are positioned to thrive in tough conditions. Read on to see why they think these stocks will deliver gains for your portfolio. 

Get in the zone

James Brumley (AutoZone): While it's true that prolonged weakness upends most stocks, there are a few exceptions. One of these likely exceptions is AutoZone (AZO 0.00%). Yes, I'm talking about the auto parts and car-maintenance chain of stores.

It sounds strange at first. Generally speaking, retailers struggle when investors are feeling a financial pinch, and people might put off putting new tires on their car if their current ones are looking "good enough." However, in that repair and replacement parts are a huge chunk of the company's business -- and repairs are rarely optional -- the auto parts business is surprisingly resilient. This company breezed right through the fallout of 2008's subprime mortgage meltdown as if it wasn't even happening. Notably, the stock did, too.

AZO Chart

AZO data by YCharts

The economic weakness that's currently brewing is marked by supply chain problems that haven't excluded the aftermarket auto parts business. Given that we've not yet seen this slowdown in AutoZone's top- and bottom-line growth, I think it's safe to say AutoZone (and its peers) are sidestepping the brunt of any supply chain woes.

In fact, I can't help but think that most auto parts stores are actually beneficiaries of the world's supply chain problems, which has limited production of new vehicles. IHS Markit recently lowered its estimated production of new cars for 2020 to only 80.6 million units, still down from 2019's tally of 89 million. Consumers may have little choice but to keep their current vehicles in working order.

A stalwart you can count on

Daniel Foelber (Lockheed Martin): The war in Ukraine has cast a spotlight on defense contractors like Lockheed Martin that make aircraft, missile systems, and provide support services. Despite increased orders from U.S. allies for Lockheed Martin's (LMT -0.00%) products, the company reported a rather muted first quarter of 2022. The lesson here is that investors shouldn't approach the pure-play defense contractor as a short-term investment, but rather understand why its gradual growth can be an excellent form of passive income over the long term.

The U.S. government is its main customer (over 75% of its business comes from the U.S. government and the rest is from U.S.-approved allies). Lockheed's backlog of contracts gives it a steady stream of revenue for future years.

The main criticism of Lockheed has been its lack of growth. While it's true that Lockheed's sales and profits have been climbing at low single-digit rates in recent years, Lockheed makes up for its lack of growth with its strong dividend and a reasonable valuation.

Lockheed has raised its dividend for 20 consecutive years and has a dividend yield of 2.6%. If it maintains its streak, it will become a Dividend Aristocrat -- an S&P 500 component that has paid and raised its dividend for at least 25 consecutive years -- by 2027. Lockheed also has a price-to-earnings ratio under 19 even though its stock price is up 20% year to date.

LMT Chart

LMT data by YCharts

So far this year, Lockheed has outperformed many of its defense contractor peers and is easily beating the S&P 500 and the industrial sector. Some context is in order, as Lockheed stock had been a market underperformer leading up to 2022 but is now about even with the S&P 500 over the last five years. 

Lockheed isn't the kind of company that is going to wow investors with exceptional growth. And given the stodgy process for winning bids and executing on contracts, a lot of Lockheed's growth is out of its control and depends on government funding. However, the barriers to entry for defense contracts are high, which protects Lockheed from competition.

Investors looking for a dividend stock that can do well despite the market cycle could consider Lockheed Martin now.

A pending acquisition leaves room for attractive upside

Keith Noonan (Activision Blizzard): Under normal circumstances, Activision Blizzard (ATVI) might seem like an odd pick for a stock that's well suited to posting gains amid bear-market and recession conditions. The video game publisher has typically traded at growth-dependent valuations that open the door for volatility, and its business hasn't been completely immune to economic pressures despite demand for interactive entertainment holding up relatively well in tough times. However, the company is on track to be acquired by Microsoft within the next year, and its stock still trades at a substantial discount to the buyout price. 

With Activision Blizzard stock currently trading at roughly $78 per share, it offers approximately 22% upside in relation to the $95-per-share price that Microsoft is poised to acquire the publisher at. Why can shares be purchased at such a big discount when the deal is seemingly on track to close in the near future? Well, the market thinks there's a big risk that the deal will fail to get the necessary approvals from the Federal Trade Commission and other regulators. 

Microsoft is one of the most powerful tech companies in the world, and it's also got a strong position in the gaming industry thanks to its Xbox and PC platforms and services. With that in mind, it's not shocking that investors think there will be some antitrust hangups that could ultimately cause the Activision deal to fall apart. 

On the other hand, Microsoft has actually been lagging far behind rivals Sony Group and Nintendo when it comes to console market share, and its real competition extends beyond those heavily gaming-focused players. Companies including Amazon, Meta Platforms, Apple, Alphabet, and Tencent Holdings also have encompassing platform-and-services ecosystems, and Microsoft can make the case that its acquisition of Activision doesn't meaningfully tip the scales (or even increases competition) in the world of big tech. Walt Disney and AT&T made similar arguments when successfully pursuing even larger media acquisitions of their own within the last few years.

The market is pricing in a significant chance the deal won't go through, but the risk appears overblown, and the prospect of netting a 22% return within roughly a year's time is attractive given the current market conditions and the fact that it's an all-cash deal. I own Activision Blizzard stock and intend to hold on to my shares until the acquisition is completed.