It's easy to feel discouraged when investing lately. The midterm election's results all but guarantee gridlock for at least the next couple of years, and while the third quarter's earnings season hasn't been disastrous, it's hardly been impressive either.

The S&P 500's (^GSPC 1.02%) third-quarter earnings per share figure is essentially on pace to match the year-ago number, and the fourth quarter is expected to be down year over year. Nevertheless, there's far more clarity regarding the economy's condition than there was just a few weeks ago. That's a big deal since sheer uncertainty can work against most stocks' prices.

Here's a rundown of five stocks you can feel good about stepping into right now, even if the backdrop is less than ideal. We know enough to know these companies will manage just fine in the near and distant future.

Microsoft

It's not a name that needs much of an introduction. Microsoft (MSFT 1.82%) is responsible for the world's most-used computer operating system and sells much of the software installed on those computers. The company also owns LinkedIn, the Xbox video gaming console, and a popular cloud computing platform called Azure.

While these revenue-producing products are certainly recession-resistant, Microsoft isn't completely immune to economic headwinds. Just last month, the software giant confirmed it's laying off several hundred people, following August's instructions from CFO Amy Hood to dial back training and travel costs. The company's disappointing guidance for the quarter now underway is adding to the stock's continued sell-off.

All this selling, however, is overdone. Revenue and earnings are expected to rekindle double-digit growth paces next year, when the worst of any economic turbulence should be in the rearview mirror. Since stock prices are largely predictive of future corporate performance, look for Microsoft shares to begin their recovery well before then.

Estee Lauder

Yes, The Estee Lauder Companies' (EL 1.70%) Q3 results delivered something of a mixed message.

Earnings of $1.37 per share topped expectations of $1.31, but were down from the year-ago bottom line of $1.88. Revenue of $3.9 billion slipped 11% year over year, falling short of the consensus as well. Perhaps worse, the cosmetics company cautioned shareholders that further business disruptions could be in the cards -- particularly in China.

As was the case with Microsoft, however, people are forgetting what a powerhouse this brand is. It will survive this headwind. Indeed, it might shrug it off even sooner than most investors expect. Analysts with Wells Fargo just raised their price target on Estee Lauder to $225, citing newly improved cosmetic imports into China, where the company does roughly a third of its business.

Palo Alto Networks

Economic weakness is already prompting several organizations to curb their technology spending plans. There are some tech investments, however, that just aren't optional. Cybersecurity is one of those investments; cybercrime isn't a cyclical industry.

Enter Palo Alto Networks (PANW 0.91%). It's not only one of the world's biggest cyberdefense names, but one of the best. Its edge-computing protection is especially impressive, and it's one of the reasons quarterly revenue hasn't fallen on a sequential or year-over-year basis since before 2013. That includes the middle of 2020, when the COVID-19 pandemic was stifling spending of nearly every other kind.

And the need isn't abating. While Palo Alto shares have been lackluster performers this year, analysts are still calling for top-line growth of more than 20% this year and next. Likely eyeing all the hacking and data breaches that surfaced during the pandemic, technology market research and consulting outfit Gartner estimates enterprises will spend 11.3% more on cyberdefense next year than they are this year, and this year's cybersecurity spending is on pace to grow 14.3%.

Costco Wholesale

Saving money never goes out of style, even when you have to pay money to save it. That's the premise that's kept Costco Wholesale (COST 1.01%) marching forward in good times and bad. Like Palo Alto Networks, Costco hasn't failed to produce year-over-year quarterly revenue growth in over a decade.

Fans and followers of the stock likely know Wells Fargo recently downgraded it, explaining that shares were priced too richly in light of headwinds on the horizon. These headwinds include tough post-pandemic comps and the sheer effect of inflation.

Largely lost in all the noise, however, is that Costco is already proving itself a smart answer to inflation. Last month's overall same-store sales growth (not factoring in gasoline prices) rolled in at a healthy 6.7%, down only slightly from September's 7.7%. The stock's subpar performance just doesn't reflect the company's resiliency.

McDonald's

Finally, add fast food chain McDonald's (MCD -0.91%) to your list of prospective stocks to buy right now if you've got an extra $500 you won't be needing anytime soon.

You'll never make an overnight fortune owning a stake in McDonald's. With nearly 40,000 locales operating under a Golden Arches sign, the big company just moves too slowly to dish out earth-shattering growth. What you will get with McDonald's, however, are consistent results and an equally consistent dividend currently yielding 2.2%. Not only has the organization made a payment every quarter for years now, it's upped its annual dividend payout in each of the past 42 years.

This consistency stems from the company's underlying business model. While you may know it as a fast-food brand, it's also considered by some to be a massive real estate outfit. That's because a huge portion of its revenue stems from rent payments that franchisees must pay the company to run a restaurant business out of all the parent-owned buildings. These rent payments are even more predictable than royalties and franchise fees.