Amazon.com Inc. has followed Apple Inc. to become the second U.S. company to reach $1 trillion in market value, reflecting the online retailer’s striking transformation from a profitless bookseller into a disruptive force of commerce.

Shares of Amazon climbed 1.9% in midday trading on Tuesday, topping the $2,050.27 needed to push the company’s value above $1 trillion. The stock has surged 75% in 2018 and added more than $435 billion to the company’s market capitalization—roughly the size of Walmart Inc., Costco Wholesale Corp. COST +0.34% and Target Corp. TGT 0.82% combined.

Investors have rewarded the Seattle-based company as it demonstrated better financial discipline in recent quarters, reporting record profits because of lucrative businesses such as cloud computing despite aggressively spending on industries from health care to grocery delivery.

“They’ve proven they can make it work,” said Michael Lippert, who manages the Baron Capital BCAP -98.00% Opportunity Fund that counts Amazon as its largest holding. “They’re spending a lot on all these things to build and enforce their competitive advantages.”

Amazon and Apple, which hit the trillion-dollar milestone on Aug. 2, symbolize the growing influence of tech companies on markets and the economy. The industry is amassing wealth and power, creating a new order in business where the most valuable resource is no longer oil, but data.

Not far behind in market value are Google owner Alphabet Inc. and Microsoft Corp. , both approaching $900 billion, while Facebook Inc. which crossed $500 billion in July 2017, a day after Amazon—has stalled at those levels amid a data-privacy scandal and growth concerns.

The companies’ increasing clout has prompted lawmakers to scrutinize the tech sector more closely. Amazon, which captures nearly half of all U.S. dollars spent online, is simultaneously drawing the ire of President Trump over its effect on traditional retail and its use of the U.S. Postal Service. Sen. Bernie Sanders has also criticized the company for the way it pays and treats its warehouse workers, something Amazon has said is an inaccurate portrayal.

Investors also worry about the tech companies’ outsize impact on the stock market. Amazon, Apple and Microsoft have accounted for more than 35% of the S&P 500’s total return this year, according to S&P Dow Jones Indices data through Aug. 28.

One of the biggest beneficiaries of Amazon’s growth is its 54-year-old leader, Jeff Bezos, who has surpassed Bill Gates to become the richest man in the world, according to multiple indices that track the world’s wealthiest people. Mr. Bezos owned roughly 16% of Amazon, as of an August regulatory filing, and is worth about $166 billion, according to the Bloomberg Billionaires Index.

Amazon has expanded rapidly since its humble founding as an online bookstore in Mr. Bezos’s garage in 1994. The internet then was just becoming a viable platform, and the most valuable companies at the time included industrial conglomerate General Electric Co. , oil giant Exxon Inc. and telecommunications power AT&T Inc.Amazon was valued at less than $500 million when it went public in 1997. A $1,000 investment in the IPO would be worth roughly $1.4 million today, adjusted for stock splits.