If you have $5,000 ready to invest and want to generate returns that beat the market over the long run, putting that money into tech stocks would be a great idea. They tend to outpace the broader market's gains by handsome margins.

For example, Applied Materials (AMAT 0.73%) and Apple (AAPL 0.52%) have delivered fantastic gains for investors in recent years. A $5,000 investment in either of those companies five years ago would now be worth more than $25,000 -- and that's without factoring in their dividend payouts. And Apple and Applied Materials could replicate those outstanding performances over the next five years. What's more, both stocks are ripe for picking right now, as they are trading at attractive valuations.

Person sits at a desk at home with a large headset in front of a laptop computer.

Image source: Getty Images

The case for Applied Materials

Applied Materials stock has been a strong performer over the years despite slow growth for the company on the financial front. The company's 10-year revenue compound annual growth rate (CAGR) is just over 6%, while earnings have increased at an annual rate of just over 12.5% over the past decade.

However, Applied Materials has transformed into something of a high-growth company since the beginning of 2020 thanks to robust demand for semiconductor manufacturing equipment amid a global chip shortage. The company's revenue shot up 41% year-over-year in Q2 to $5.58 billion, while adjusted earnings jumped 83% to $1.63 per share.

AMAT Revenue (TTM) Chart

AMAT Revenue (TTM) data by YCharts

Its top and bottom lines have taken off since the beginning of last year. Investors can expect Applied Materials to sustain its terrific momentum as spending on the semiconductor manufacturing equipment that it sells is expected to keep growing at eye-popping rates. Chip giants have announced plans to spend hundreds of billions of dollars to increase their production capacity in the coming years. This bodes well for Applied Materials. That market is by far its largest source of revenue, accounting for over 71% of its top line.

Moreover, last quarter, the company's semiconductor systems revenue was up nearly 55% year over year to $3.97 billion. That outstanding growth was driven by new capacity investments in the memory and the foundry/logic verticals. It is worth noting that Applied Materials is now in a stronger position to take advantage of the increase in semiconductor manufacturer spending because it has boosted its own market share. As CFO Dan Durn pointed out on last month's earnings conference call:

Applied Materials was No. 1 in both equipment and services for 2020. The equipment market was $61.2 billion, up nearly 19% year on year. We significantly outgrew the market, gaining 60 basis points of industry market share with gains in deposition, removal, and process control.

The company expects to keep outperforming the industry it operates in. This explains why analysts are bullish about its long-term prospects and project 25% annualized earnings growth for the next five years. Meanwhile, Applied Materials' second-largest business -- Applied Global Services (AGS) -- is also stepping on the gas. AGS revenue was up 18% year over year last quarter to a record $1.2 billion, amounting to nearly 22% of the top line. Through that business, Applied Materials offers spare parts, automation software, services, and consulting. This business is in the midst of a particularly successful patch; it recorded its highest operating margin in almost 15 years, driven by an increase in sales of subscriptions.

In all, Applied Materials' two major businesses are firing on all cylinders, and they are expected to drive robust long-term growth. That's why putting down $5,000 to buy Applied Materials stock looks like a good idea right now, considering that it trades at 29 times trailing earnings, which is significantly lower than the industry's average of over 47.

The case for Apple

Apple's top- and bottom-line growth nearly disappeared for a couple of years starting around the end of 2018. But the iPhone maker has regained its mojo in the past few months thanks to the arrival of its 5G-enabled iPhone 12 lineup. Customers have been buying the latest version of its popular smartphone hand over fist.

AAPL Revenue (TTM) Chart

AAPL Revenue (TTM) data by YCharts

Apple now holds the No. 1 spot on the 5G smartphone sales charts. Its momentum looks sustainable thanks to the secular growth of the 5G smartphone market, a massive installed base of iPhone users who are in an upgrade window, and the competitive pricing of its phones. The iPhone lineup is Apple's largest source of revenue, accounting for just over 53% of sales last quarter, when it registered 66% year-over-year growth. As sales of 5G smartphones are set to explode in the coming years, investors can expect the iPhone line's revenues to grow at elevated levels. Apple could get a big shot in the arm as a result, as the iPhone's strong sales last quarter led to a 54% year-over-year jump in its total Q2 revenue to $89.6 billion. 

Even better, Apple is gaining ground on multiple fronts. As CEO Tim Cook pointed out on the April conference call: "Mac and services delivered all-time record results, and we set new March quarter records for iPhone and wearables, home and accessories."

The company's services business registered nearly 27% year-over-year growth last quarter to $16.9 billion, accounting for nearly 19% of the top line. It is worth noting that Apple's services revenue last year was twice the figure from 2016. The company is expected to build upon that impressive growth and nearly double its services revenue again by 2024. The forecast is for $100 billion in annual services revenue as compared to $53.8 billion last fiscal year. Evercore ISI analyst Amit Daryanani estimates that the services business could achieve an annualized growth rate of 19% through 2024.

Meanwhile, Mac revenue has surged by 42% in the first six months of fiscal 2021 to $17.7 billion, driven by the computing needs of remote workers and students adapting to online education. Global demand for personal computers is expected to remain strong with annual growth of 3.5% expected through 2025. As such, Apple's prospects in the PC market appear to be solid, especially considering that it is making inroads into emerging markets that could help feed its long-term growth in this segment.

The tech stock is trading at 29 times trailing earnings, well below last year's average of 40. A forward multiple of 23 points toward bottom-line growth, which analysts estimate will be a recurring feature for the next five years. Apple's earnings are expected to grow at an annualized rate of almost 18%.

In all, Apple has multiple catalysts and trades at an attractive valuation, which is why investors looking to buy top growth stocks right now should seriously consider the tech giant.