Amazon (AMZN -1.51%) has been a company to watch this year, with its e-commerce business rebounding from a disastrous 2022 and an increasing position in artificial intelligence (AI). The retail giant's stock has risen some 55% since Jan. 1, as Wall Street has grown increasingly bullish over its long-term prospects.

Founded nearly 30 years ago in 1994, Amazon has come a long way since starting out as an online book retailer out of Seattle. Its online marketplace has made it a household name worldwide, with its stock rising about 700% over the last decade. The company has stumbled over the last year, having to contend with macroeconomic headwinds and declines in consumer spending. However, a return to profitability in its e-commerce business and a burgeoning AI division could take it far over the next five to 10 years. 

So, is it still worth buying Amazon stock, or is it too late? Let's find out.

Solid long-term prospects 

Amazon had one of its most challenging years in 2022, with an economic downturn leading to steep profit losses in its retail business. However, the company has given investors plenty to rally over since the start of this year. Its North American segment returned to profitability in the first quarter of 2023 and hit over $3 billion in operating income in Q2 2023, a massive improvement from the $627 million in losses it reported in the year-ago period.

The boost to profits comes after various restructuring moves, such as closing dozens of warehouses, layoffs, and sunsetting unprofitable platforms like Amazon Care. The company's swift action and year-over-year growth illustrate management's ability to react appropriately during economically challenging conditions, making its stock a compelling long-term buy.

Amazon remains the leader in the e-commerce market in multiple countries and will likely continue profiting from its growth for years. 

Moreover, one of the best reasons to invest in Amazon is its dominance in the cloud market and what that could mean for its future in AI. After appearing to fall behind Microsoft in AI last year, Amazon has pivoted large parts of its business to the booming sector.

In 2023, the retail giant has added several new AI tools to its cloud platform, Amazon Web Services (AWS), and announced a venture in chip development, which could see it challenge Nvidia. Then, last month, news broke Amazon will invest up to $4 billion in AI firm Anthropic, a rival to ChatGPT developer OpenAI. 

Increased interest in AI has sent demand skyrocketing for services that allow businesses and consumers to boost productivity with the technology. As a result, the AI market is projected to expand at a compound annual growth rate (CAGR) of 37% through 2030. With a leading market share in the cloud market, Amazon has massive potential in the industry over the long term. 

It's not too late, but there are cheaper options

It's not too late to buy Amazon stock, with its lucrative prospects in e-commerce and AI. In fact, those are excellent reasons to buy its shares now and hold over many years. However, its price-to-earnings (P/E) ratio of 101 indicates Amazon's stock is trading at an expensive price point. Meanwhile, cheaper options are too hard to ignore. 

AMZN PE Ratio Chart

AMZN PE Ratio data by YCharts.

The chart above shows Microsoft, Alphabet, and Apple all have significantly lower P/Es and offer alternative ways to invest in cloud computing, AI, and even e-commerce with Apple's role in consumer tech. Out of these companies, Microsoft is probably the best alternative to Amazon's stock for those looking to add an AI/cloud stock to their portfolio. The Windows company holds the second-largest market share in cloud computing after Amazon. Meanwhile, Microsoft's 49% stake in OpenAI gives similar, if not more, potential in AI.

Additionally, Microsoft's stock tumble of 29% in 2022 compared to Amazon's 50% suggests Microsoft is less vulnerable to economic headwinds, which could make it a more reliable option.

So, it's not too late to invest in Amazon. However, it might be a good idea to consider other options first and come back to its stock when it's trading at a more attractive price.