Last year was a terrible one for tech stocks, with hikes in inflation dragging down the entire market. Market leaders Amazon (AMZN 1.42%) and Alphabet (GOOG -1.47%) (GOOGL -1.51%) experienced stock declines of 50% and 39%, respectively, throughout 2022 as a result.

However, the market has seen a surge in 2023, with industries like artificial intelligence (AI) and cloud computing gaining favor with investors. Consequently, companies in these sectors have become increasingly compelling investments before a likely bull run.

Dominant in their respective markets, Amazon and Alphabet have seen their companies flourish over the years, and their potent businesses are likely to keep expanding.

1. Amazon 

An economically challenging 2022 caused steep declines in Amazon's e-commerce business, with its North America and international segments reporting a combined $10.6 billion in operating losses in the fiscal year. As a result, the company's stock remains down over 30% year over year, prompting a buying opportunity.

E-commerce remains a steadily growing industry alongside the rise in online retail sales, with temporary headwinds unlikely to affect Amazon's long-term development. In the meantime, Amazon has a thriving cloud business through Amazon Web Services (AWS), boasting the largest market share at 34%. The COVID-19 pandemic boosted cloud adoption as numerous companies moved online to suit hybrid working styles. In recent months, advances in AI have similarly boosted the industry, with the technology enhancing cloud services and attracting new clients.

Amazon's dominance in the industry led AWS to generate 100% of the company's profits in 2022, hitting $22.8 billion in operating income. 

Recent challenges have brought down Amazon's stock and e-commerce business. However, the company's long-term outlook is positive, and Wall Street seems to agree. Out of 50 analysts, 46 have rated the company's shares a strong buy or buy. Meanwhile, Amazon's average 12-month price target of $137.37 projects a 34% stock rise, making Amazon a no-brainer investment in 2023 and beyond.

2. Alphabet

Last year's sell-off was particularly hard on Alphabet as many businesses slashed their budgets for advertising, the company's primary source of income. Then, the launch of OpenAI's ChatGPT in November 2022 sent Alphabet's stock tumbling further, with the AI chatbot posing a threat to Google's majority market share in search engines.

However, the company appears to be back on a growth path. In March, inflation eased for the ninth month in a row, hitting its lowest level since May 2021. Inflation rose 5% last month, down from 6% in February and a peak of 9.1% in June 2022. The news is positive for many tech stocks, including Alphabet. As inflation eases, businesses will be keener to utilize the company's digital advertising services, offering steady revenue growth.

Moreover, Alphabet has responded to the release of ChatGPT and its integration into Microsoft's search engine Bing by pivoting its own business toward AI development. The move has given Alphabet something it has needed for years -- a clear and definitive direction. With little effort, the company has held an over 80% market share in search engines for decades. However, increased competition has lit a fire under Alphabet to retain that market share and develop its rival to ChatGPT, which it calls Bard.

The launch of Bard in February was discouraging, with the chatbot sharing inaccurate information at its debut and failing to instill confidence in investors. But Alphabet's dominant influence in search grants it some time to improve its own tech and Google remains a formidable opponent -- even for Microsoft's Bing. Over the long term, I wouldn't bet against the Google company taking the lead in generative AI search engines.

Like Amazon, many experts are bullish about Alphabet's stock, with 47 out of 52 analysts rating it a strong buy or buy.

As the home of potent brands such as Android, YouTube, and the many services under Google, Alphabet is a leading tech company with attractive long-term prospects. With a 12-month price target of $125, which is 14% higher than its current position, Alphabet's stock is a must-buy this year.