Amazon Asked for Patience. Remarkably, Wall Street Complied.

Allen Gillespie is one lonely stock analyst.

Of the dozens of Wall Street analysts covering Amazon, he is the only one tracked by Bloomberg who recommends that investors sell the company’s shares.

Mr. Gillespie, a partner at FinTrust Investment Advisors, a wealth management firm in Greenville, S.C., questions whether Amazon deserves such a stratospheric share price.

“Everybody thinks I am crazy,” said Mr. Gillespie, who also serves on the board overseeing South Carolina’s pension fund. “I have had people I’ve never met email me to ask if I was serious.”

It is a bold call indeed. Since Mr. Gillespie put a sell rating on the company last July, Amazon’s shares have increased 37 percent, to $1,429. On Friday, one day after Amazon reported the biggest quarterly profit in its history, Amazon’s market value briefly crossed the $700 billion mark, and its share price increased 3 percent even as the Dow fell 2.5 percent.

For most analysts, the end is not yet in sight. When the investment firm D.A. Davidson & Company predicted last month that Amazon’s shares could rise to $1,800, Morgan Stanley upped the ante the next day, forecasting a possible $2,100 share price.

“It’s an infatuation,” said Scott Galloway, a professor of marketing at New York University’s Stern business school, who recently published a book about Amazon, Google and other tech giants.

How that infatuation developed is the story of a company that figured out how to tame Wall Street. In a business environment that demands, and rewards, quarterly profits and short-term strategic thinking, Amazon showed extraordinary resolve in focusing on long-term goals, somehow convincing investors to go along.

Over its first decade in existence, including long stretches where it consistently reported losses, Amazon enjoyed a luxury afforded few companies: leeway.

“I think it comes down to a consistent message and consistent strategy, one that doesn’t deviate when the stock goes down or goes up,” said Bill Miller, the chief investment officer at Miller Value Partners, whose largest holding is Amazon.

In part, Amazon has inured itself to pressure from Wall Street by ignoring it. While many chief executives devote significant time to fielding questions from investors, Amazon’s founder and chief executive, Jeff Bezos, is famously stingy about the time he spends with major stockholders. He hasn’t appeared on an Amazon earnings calls in years.

In a 2014 interview with Business Insider, Mr. Bezos said he spent a measly six hours a year on investor relations and then only with long-term shareholders, who have been willing to weather the company’s ups and downs. Mr. Miller is one of them.

Mr. Bezos has constantly reminded the market of his philosophy. Each year in the company’s annual letter to shareholders, Amazon attaches a copy of the very first letter from 1997, its first as a publicly traded company.

“We will continue to make investment decisions in light of long-term market leadership considerations rather than short-term profitability considerations or short-term Wall Street reactions,” Mr. Bezos wrote in a section of the letter titled, “It’s All About the Long Term.’’

Mr. Bezos has been true to his word. Amazon has reported an annual profit in only 13 of the 21 years that it has operated as a publicly traded company, according to FactSet, a financial data firm.

An Amazon spokesman declined to comment.

And its profit margins, already low by some measures, have fluctuated from year to year — hardly moving in the straight upward line that Wall Street usually likes to see.

Yet investors have rewarded Amazon for plowing its profits back into growing its businesses, whether in online retail, cloud computing or, most recently, in grocery stores, with the acquisition of Whole Foods Market.

It may sound like a Pollyanna view of stock investing, particularly in a market increasingly dominated by trading algorithms and macro bets on the direction of interest rates. But in the case of Amazon, it is actually true.

“If Wall Street would allow more companies to reinvest like Amazon, it would create great benefits for the economy,” said Henry Blodget, a former stock analyst, who first came to prominence in 1998 by setting a $400 price target for Amazon shares. (He is now editorial director of the online publication Business Insider, in which Mr. Bezos was an investor.)

The reality of the economy, however, is that most other companies are still playing by Wall Street’s old rules, which demand consistent profit growth.

And to compete with Amazon and meet those profit expectations, many retailers and manufacturers are laying off workers, closing stores and shedding factories. Last month, Kimberly-Clark, under pricing pressure from Amazon and Walmart, said it was laying off more than 5,000 workers and closing or selling 10 of its factories.

It wasn’t always so easy for Amazon. During the tech boom of the late 1990s, Amazon was one of a number of promising tech start-ups that were losing money. But it showed the potential for longer term profit, as it moved from selling books into music and toys.

But like the rest of the tech sector, Amazon’s shares tumbled in 2000 and 2001 as investors began to wonder if these companies could ever make money. A young debt analyst at Lehman Brothers warned in June 2000 that Amazon might soon run out of cash, causing investors to worry about its survival.

Mr. Bezos had squirreled away enough capital to get through those dark days. But it took many years for investors who had been burned by the dot-com crash to give Amazon a second chance.

For long stretches from 2002 to 2006, Amazon’s stock price languished, while it invested in researching and developing new technologies and businesses.

Mark Mahaney, a tech analyst at RBC Capital Markets, looked at the company’s slipping profit margins during that period and warned investors to stay away.

Mr. Mahaney said he failed to realize “that all that spending on R.&D. was a bullish sign for the future.” He has had a buy rating on the company for more than a decade.

Those long-term investments, which Amazon didn’t detail at the time, eventually gave rise to some of the company’s most profitable businesses, like its cloud computing unit, Amazon Web Services.

The success of the cloud computing business proved a tipping point. If investors allowed Amazon to spend time and money investing, patience would pay off.

Investors are now awaiting the payoff from Amazon’s foray into groceries with its $13 billion acquisition of Whole Foods last spring. How it plans to integrate hundreds of brick and mortar stores with its core e-commerce business is far from clear.

By now, Wall Street has been well trained to believe that Amazon has a strategy for Whole Foods and it will take time to carry it out.

“What the market finally figured out is Amazon is extremely good at investing those dollars,” said Mr. Miller, the investment officer at Miller Value Partners.

Ultimately, much of the investor confidence in Amazon reflects a belief in its future opportunity — what investors frequently call a company’s “addressable market.”

For Amazon, the addressable market in retail is roughly $5 trillion in the United States and many times that globally, Mr. Miller said. And that’s not even including the traditional information technology market that Amazon Web Services is attacking. “I asked Jeff what the addressable market is for A.W.S.,” Mr. Miller said. “He just looked at me and said, ‘Trillions and trillions.’”

Online spending represents less than 10 percent of total retail spending, and Amazon captures almost half of every dollar spent in online shopping by Americans.

Even Mr. Gillespie, the skeptic, acknowledges that Amazon is “operating extremely well.” But he questions whether years of low interest rates have helped inflate Amazon’s value because investors are so starved for return, they are willing to overlook some of the risks.

Those risks, he said, include regulators deciding the company is growing too large or not paying its fair share in taxes.

“People tend to assume away these things,” he said.