SAN FRANCISCO — When Apple’s market value crossed a trillion dollars last month, the reason was simple: It makes devices that a lot of people are willing to spend a lot of money on.

Now Amazon has become the second American company to cross that once-unimaginable line. Its shares rose as high as $2,050.50 on Tuesday morning, pushing it over $1 trillion in value, before immediately falling back and then ending the day at $2,039.51, below the $1 trillion threshold. Amazon’s founder and chief executive, Jeff Bezos, is worth nearly as much as Bill Gates and Warren E. Buffett put together.

This time, the explanation is more complicated.

Amazon captures 49 cents of every e-commerce dollar in the United States. It employs more than 550,000 people and generates $178 billion in annual revenue. It sells everything from computing space to peanut butter to appointments with plumbers.

But the thing it has always sold the most — to investors, customers, the news media — is excitement.