Technology stocks have gone from being the best-performing sector of the past decade to one of the worst this year. The tech-heavy Nasdaq 100 gained 4,000% over the past 30 years but is down 26% in 2022. The other broad-based indexes aren't faring much better, either.

Yet despite the sector's miserable performance, smart investors see this as an opportunity to pick up shares of beaten-down good tech growth stocks that haven't been as affordable as they are today. The following pair of leading tech stocks are ones to buy this year and own in the years to come.

Person looking at stock charts.

Image source: Getty Images.

Pinterest

Social sharing platform Pinterest (PINS -0.64%) has fallen hard over the past year because people rediscovered out-of-home activities during the pandemic lockdowns. When people were forced to be cooped up, they used Pinterest's virtual corkboard technology to pin ideas for sprucing up their homes or activities they could perform as a family. Once freedom of movement was permitted again, pinning ideas online became a back burner idea, and monthly active users decreased 9% to 433 million last quarter.

More recently, though, Pinterest is suffering from concerns about a recession causing a cutback in advertising, as well as Apple updating its privacy settings to allow users to opt out of being tracked by advertisers because almost all of its revenue comes from ads. Yet these could be overblown worries when it comes to Pinterest.

Snap, for example, got crushed the other day because its revenue growth slowed dramatically on slowing ad sales, but Pinterest is actually an advertiser's dream. Snap and other social media platforms are trying to shoehorn an ad-based model onto their apps, but Pinterest users are commonly looking for things to spend money on, so it melds perfectly with an advertising model. 

Certainly, a recession will dent consumers' ability to shop, but this is a comparatively short-term concern at best. Global revenue per user still jumped 28% in the first quarter, showing Pinterest is still able to monetize its users. And after having lost over three-quarters of its value in the past year, the Pinterest stock is at a level that makes it attractive for investors with a long-term mindset and the patience to see it grow into an online e-commerce powerhouse.

Amazon

Amazon (AMZN -1.65%) has suffered the same meltdown in its stock as Pinterest has (the e-commerce giant is down "only" 37% in the last 12 months), even though its growth seems assured. The recent two-day Prime Day sales event resulted in $12 billion in global sales, a new record, and on a sales-per-day basis, it far exceeded JD.com's three-week-long 618 sales extravaganza. While JD racked up over $56 billion in sales, that works out to less than $2 billion a day. Amazon generated over $6 billion a day for its event.

Yet that's not even the exciting part about Amazon, because its cloud services business Amazon Web Services remains the fastest-growing part of its operations and is still the most profitable. Revenue in the segment jumped 37% last year, hitting $62 billion, and rose by a like percentage in the first quarter.

Amazon is further expanding AWS's capabilities for leading-edge technologies such as streaming video, online gaming, and augmented and virtual reality by creating "local zones" that bring the storage and database infrastructure closer to the customer. Doing so allows for split-second data travel times, which increases efficiency.

Amazon recently completed its 20-for-1 stock split, bringing the stock down to an accessible $114 per share. Although shares still go for 45 times next year's earnings estimates, Wall Street still expects the company to be growing profits at a 33% compound annual rate for the next five years, making Amazon a growth tech stock in every sense of the word and one to buy and hold for years to come.