There is no need to be a multimillionaire to invest in stocks, especially after the beat down equity markets took over the past year. Even a relatively modest sum such as $1,000 can go a long way for investors willing to hold stocks through even the most challenging downturn.

For it to pay off over the long run, investing in companies that can deliver superior returns in five years or more is essential. Let's consider two leading tech stocks that have the tools to pull it off: Meta Platforms (META -4.13%) and Alphabet (GOOG -1.10%) (GOOGL -1.23%).

1. Meta Platforms

Nothing went right for Meta Platforms in 2022. The parent company of Facebook saw its revenue growth decline substantially on a year-over-year basis due to a drop in spending in the advertising business. Elsewhere, Meta's bottom line is also being squeezed, partly due to investment in the company's metaverse ambitions, which don't look likely to bear fruit anytime soon.

But even with all these issues, Meta Platforms is an outstanding stock. The company's decreasing revenue growth rate is a product of the struggling economy. As usual, looking at a longer time frame helps put things in context. Meta Platforms' top line has been on an impressive growth path for over a decade.

META Revenue (Quarterly) Chart

META Revenue (Quarterly) data by YCharts

And while its investment in the metaverse may be harming the bottom line, this could eventually be a massive $1 trillion opportunity, according to some estimates. Meta Platforms is putting itself in a solid position to profit from it down the line. Further, the metaverse isn't the only new source of revenue the company will be counting on.

Meta Platforms' ecosystem of 3.71 billion monthly active users across all of its websites and apps as of the end of the third quarter represents major monetizing opportunities. For instance, the tech giant is currently ramping up its efforts to monetize WhatsApp with click-to-messaging ads and paid messaging. Elsewhere, Meta also reported that Facebook Reels, designed to compete with the hugely popular TikTok, is growing rapidly.

Meta Platforms has also been cutting jobs to decrease costs. In November, it announced it would cut as much as 13% of its workforce. Investors can expect the company's revenue and earnings to start growing again once economic conditions improve. In the meantime, its forward price-to-earnings ratio of 16.4 is slightly lower than the S&P 500's 19, and well worth it for a tech leader with a broad customer base and multiple long-term monetizing opportunities.

At these levels, Meta Platforms is too juicy to pass up

2. Alphabet

Alphabet, the parent company of Google, also makes most of its money from advertising, so it's no surprise that its financial results and share price have been suffering lately. But here, too, it's important to look beyond dynamics related to economic cycles. Alphabet is sure to recover once things pick up again. After all, it isn't easy to find a company that has a stronger grip on online advertising than it does.

First, Alphabet's Google is the leading search engine in the world by some margin. It held an 84% market share as of December. Could other players significantly eat into Alphabet's dominance? It won't be easy since Google has such tremendous name recognition and benefits from a solid network effect. Alphabet improves search results on Google based on the data it gathers, which becomes more plentiful when even more people use the famous search engine.

Alphabet's YouTube, one of the leading video hosting platforms, also benefits from the network effect. Google and YouTube reign as two of the most visited websites in the world. There is no chance that advertisers will ignore this massive ecosystem once economic conditions improve. One of Alphabet's other major sources of revenue is cloud computing, a growing industry in which it is one of the leaders through Google cloud.

So not only does Alphabet provide services that are invaluable to people's daily lives, but it also offers cloud-based products that are increasingly becoming popular among businesses thanks to their efficiency and productivity-related benefits. And on top of that, its shares are also reasonably valued at the moment, with a forward P/E of about 16.7 as of this writing.

Alphabet's dominant position in online advertising and cloud computing would warrant even a significant premium compared to average market valuations. That's why it's a great idea to buy shares of the tech company right now.

Beyond the recent downturn

Meta Platforms and Alphabet have a lot going their way. One of the keys to the success of both companies has been their ability to attract and retain large ecosystems of clients. And since that won't change anytime soon, Meta and Alphabet are more than capable of bouncing back from the headwinds that have severely impacted them over the past year and rewarding shareholders over the long run.