Apple Inc, the world's most valuable publicly listed company, is in danger of being beaten by Inc to the $1 trillion mark.

Wall Street's optimism about last year's 10th anniversary iPhone had propelled Apple's stock 24 percent higher over the past 12 months, giving it a market capitalization of $893 billion.

That is $141 billion more than the $752 billion market value of Amazon, the world's third most valuable publicly listed company, but Amazon has been closing the gap.

Amazon's stock has surged 83 percent over the past year, bolstered by scorchingly fast revenue growth as more shopping moves online and businesses shift their computing operations to the cloud, where Amazon Web Services leads the market.

To be sure, past stock gains are not a reliable predictor of future performance, and the surge in Amazon shares in recent years has been exceptional by most standards.

If Amazon's stock were to keep growing on the trajectory seen over the past year, the company's market capitalization would hit $1 trillion in late August.

Most Wall Street analysts are not quite that enthusiastic.

Analysts covering Amazon on average expect its stock to rise 10 percent within the next year to reach $1,700, which would give it a market value of $823 billion.