The massive sell-off in technology stocks this year means that investors can get their hands on the stock of some terrific companies that could shape our future at relatively attractive valuations.

The Nasdaq-100 Technology Sector index has slipped about 30% so far in 2022, so it is not surprising to see that some of the top names that make up the index have been crushed as well. Nasdaq stocks such as Apple (AAPL 0.52%) and Amazon (AMZN -1.65%) have borne the brunt of the market sell-off in 2022.

Chart showing fall in prices of Apple, Amazon, and the Nasdaq-100 Technology Sector in 2022.

^NDXT data by YCharts

Given the robust long-term prospects for these two companies, it would suggest that now might be a great time to buy these stocks. Let's take a closer look at why Apple and Amazon could give investors' portfolios a nice boost in the long run.

1. Apple

The arrival of the 5G smartphone era has been a big tailwind for Apple. The company has been enjoying impressive growth in iPhone sales volumes along with an improvement in the average sales price of each smartphone that it sells. This was evident from Apple's fiscal 2022 second-quarter results for the three months ending on March 26, which revealed a 9% year-over-year growth in revenue to a record $97.3 billion.

With the 5G smartphone market anticipated to grow at an annual pace of 124% through 2025, it won't be surprising to see Apple clock impressive growth in the coming years, as it controls a 31% share of this space.

This, however, is just one of the many reasons to buy Apple stock. The company is looking to take advantage of emerging tech trends that could supercharge its growth for a long time to come.

For instance, Apple is reportedly developing a mixed reality headset powered by both augmented reality (AR) and virtual reality (VR) as per patent filings. The tech giant is expected to launch such a device in 2023, followed by smart glasses by 2025. Apple's jump into the AR/VR headset market could turn out to be a lucrative move, as market research firm IDC forecasts that this space could grow at an annual pace of 35% through 2026.

On the other hand, it looks like Apple is stepping on the gas as far as the development of its autonomous electric vehicle is concerned. Though the company hasn't made any official statement about its vehicle development program, its recent hiring of an experienced Ford engineer indicates that such a product may be in the cards.

Analysts expect Apple's car to be launched in 2025. While that timeline may seem a tad aggressive, it is worth noting that the company has a fleet of cars that are reportedly testing its autonomous driving technology. What's more, Morgan Stanley analyst Katy Huberty believes that Apple's move into the automotive market could pave the way for the company to double its revenue and market capitalization.

All this indicates that Apple is built for solid long-term growth. That's why investors looking to take advantage of the tech stock sell-off should consider buying shares of Apple. They are currently trading at 24 times trailing earnings, which is lower than the Nasdaq-100's multiple of 26.

Person surrounded by charts, holding a smartphone.

Image source: Getty Images.

2. Amazon

Shares of e-commerce and cloud computing giant Amazon have been in the doghouse of late, with the company's first-quarter 2022 earnings report that was released on April 28 playing a part in the sell-off.

The company reported a surprise loss in Q1. It posted a loss of $7.56 per share on revenue of $116.4 billion, missing consensus estimates for a profit of $8.36 per share. Amazon's revenue increased 7% year over year, while the bottom line was a far cry from the prior-year period's profit of $15.79 per share.

The outlook wasn't encouraging either, as Amazon's revenue guidance of $116 billion to $121 billion for the current quarter is well behind the $125.5 billion Wall Street estimate. The midpoint of that range points toward just a 4% year-over-year increase in revenue, while the bottom line is expected to decline to $3.09 per share from $15.12 per share in the year-ago quarter.

Savvy investors, however, should consider focusing on the long-term picture, as Amazon's slowdown shouldn't last forever. For instance, its cloud computing business -- Amazon Web Services (AWS) -- has been growing at a terrific pace. AWS revenue increased 37% year over year in Q1 to $18.4 billion, outpacing Amazon's overall revenue growth and producing nearly 16% of its top line.

Amazon's cloud business has a lot of room for growth. According to a third-party estimate, the global cloud service market could hit $1.6 trillion in revenue by 2030 as compared to $325 billion in 2019. AWS is in a prime position to benefit from this massive growth as it controlled a third of the cloud services market in the first quarter.

The e-commerce business, meanwhile, should regain its mojo, as this market is built for secular long-term growth. Amazon's international e-commerce business declined on a year-over-year basis last quarter thanks to the challenges posed by the Russian invasion of Ukraine and the pandemic. At the same time, surging inflation and higher costs of necessities such as fuel and electricity are weighing on household budgets.

But the global e-commerce market is expected to clock an annual growth rate of 13.5% through 2030, so the near-term headwinds should eventually make way for a recovery in Amazon's e-commerce business. What's more, analysts are still upbeat about the company's long-term prospects, expecting its earnings to increase at an annual rate of 40% for the next five years.

That's why it may be a good idea for investors to accumulate Amazon stock on the dip. The stock is currently trading at 54 times trailing earnings. While that is rich, it is worth noting that Amazon has a five-year average price-to-earnings ratio of 124. Throw in the lucrative markets that Amazon could take advantage of and the fast pace of its anticipated earnings growth, and buying the stock right now could turn out to be a solid move for the long run.