Though shares of Amazon (NASDAQ:AMZN) wrapped up last week trading just over $2,000, it was just over a year ago when the e-commerce and cloud-computing company's stock was trading around $1,000. Yet some analysts are already predicting Amazon stock is headed to $2,500 or higher over the next 12 months.

Optimism for Amazon stock is rampant. Last week, one analyst set a Street-high price target for Amazon stock of $2,525. This comes a few weeks after Morgan Stanley analyst Brian Nowak set a 12-month price target for the stock of $2,500. In addition, a whopping 43 of 47 analysts have a "buy" rating on the stock.

But Stifel analyst Scott Devitt's new price target of $2,525 for Amazon stock is particularly impressive. So let's take a closer look.

Boxes in an Amazon fulfillment center

Image source: Amazon.com.

The path to $2,525

The crux of Devitt's investment thesis for Amazon focuses on the company's aggressive and timely investments in fast-growing areas.

Justifying his price target, Devitt said, "Amazon is a leader in two large and rapidly growing markets, eCommerce and cloud services. The company is investing in a number of initiatives, including Prime, AWS, India, logistics, video content, and Alexa, which will limit the opportunity for near-term margin expansion." Over the long haul, however, Devitt believes this spending will ultimately lead to increased market share and margin expansion.

Amazon has already proven its prowess in sacrificing near-term margins amid aggressive investment. In the past, investments have proved to eventually drive fatter margins. This has been particularly evident over the past year, as Amazon's gross margin has expanded significantly as the company benefits from years of heavy investment in e-commerce and cloud computing. Big investments helped improve the company's economies of scale in its North American e-commerce business and aided in the rapid expansion of Amazon's cash-cow cloud computing business, Amazon Web Services. Amazon's operating margin expanded from 1.7% in the year-ago quarter to 5.6% in the company's second quarter of 2018.

Devitt also cited the company's ability to enter new markets and build formidable new businesses as a reason to be optimistic. The analyst pointed to Amazon's thriving advertising business as one of the company's nascent businesses with big potential.

Morgan Stanley's Brian Nowak, who has a $2,500 price target on the stock, similarly expects Amazon's investments to eventually pay off in higher-margin revenue streams. Nowak specifically cited Amazon Web Services, advertising, and subscriptions as areas that could help drive long-term margin expansion.

Buy, sell, or hold?

Analyst optimism for a given stock, of course, should never be the sole reason for an investor to buy a stock. But both Nowak and Devitt make good points about the company's potential for margin expansion over the long haul. While there's bound to be lots of volatility in Amazon's operating margin in the near term, the company's aggressive investments have paid off over the long haul in the past -- and it's likely this trend will continue.

If Amazon can expand its operating margin meaningfully over the next five years, the company's earnings might grow significantly faster than revenue, potentially making Amazon's $2,024 stock price today a good entry point.

That said, Amazon undoubtedly isn't the bargain it was a year ago. So even though Amazon continues to look attractive, investors might want to keep new positions in the stock limited to a small portion of a portfolio.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Daniel Sparks has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Amazon. The Motley Fool has a disclosure policy.