Finding technology stocks that you trust will grow over the coming years feels a bit like an uphill battle right now. Persistent inflation, fears of a potential recession, and a difficult earnings environment have all contributed to investor pessimism in this sector.  

But there are good tech companies out holding leading positions in their respective markets that have the potential to make great investments over the coming years. Here's why The Trade Desk (TTD -0.54%) and Amazon (AMZN -1.65%) are two leading tech stocks to buy in 2023 and beyond.  

A person looking at a computer.

Image source: Getty Images.

1. The Trade Desk 

The Trade Desk is successfully tapping into the expanding digital advertising market while also helping the industry transition away from online trackers called cookies. The Trade Desk's development of what it called Unified ID 2.0 (UID2) has helped the digital ad industry begin to move away from pesky cookies that can keep too much personal user data. Instead, UID2 helps online users keep more of their online data private while still allowing advertisers to deliver targeted ads. 

This approach has been successful so far, with large companies including Amazon Web Services (AWS), Walt Disney, The Washington Post, and fuboTV already using UID2. 

In addition to its UID2 innovation, The Trade Desk is also successfully growing ad sales on its platform. Total revenue increased 24% in the fourth quarter to $491 million. Even more impressive was that for the full year 2022, sales rose 32% to $1.57 billion. 

The company's adjusted earnings are also trending in the right direction. Adjusted earnings before interest, taxes, depreciation, and amortization (EBITDA) rose an impressive 42% in 2022 to $668 million. 

It's getting harder to find a tech company that's increasing sales and earnings these days, but The Trade Desk is doing so while also maintaining a customer retention rate above 95%.  

The Trade Desk's strong financial results are even more impressive when you consider that the advertising industry has been hurt recently as companies pull back on spending amid fears of an economic slowdown. When the ad industry rebounds -- because it always does -- The Trade Desk's position should help it tap further into this massive industry, which is estimated to grow from $567 billion last year to $835 billion by 2026.  

2. Amazon

I won't score any points for originality for putting Amazon on this list, but I'd be remiss if I left it off. The company is, of course, a dominant player in the e-commerce market, but it's the company's AWS cloud computing segment and its digital ad business that are truly impressive right now.

AWS is Amazon's cash cow at present. While the segment's growth has slowed down a bit from its previous meteoric pace, it's still growing fast. Sales rose 29% in 2022 to $80.1 billion, and operating income rose 23% to $22.8 billion. 

AWS has become the leading cloud computing service for many companies, outpacing competition from Microsoft's Azure and Alphabet's Google Cloud. AWS currently holds 34% of the public cloud market, while Azure has 21% and Google has 11%. 

As demand for cloud computing services increases, AWS should benefit from its leading position in the market. But investors have another Amazon business that they should keep a close eye on as well. Amazon's advertising segment is a more than $30 billion business annually, and its growth over the past few years shows that it's now a top ad contender. Just a few years ago, Amazon hardly ranked among the largest ad companies; now it's estimated to have 13% of the digital ad market by 2026. 

With Amazon's strong position in both cloud computing and advertising, investors have more than one way to ride Amazon's future growth opportunities. 

Be patient with tech right now 

The tech sector is in a bit of a rough patch right now as the price of many tech stocks has been erratic lately. But the long-term potential for both Amazon and The Trade Desk is still intact. Investors who are patient with these companies as they continue to expand their advertising and cloud computing businesses will likely benefit years down the road.