Amazon CEO Jeff Bezos briefly became the world’s richest person Thursday, as stock in his e-commerce company hit an all-time high.

Microsoft founder Bill Gates reclaimed the lead by afternoon, as Amazon’s stock fell nearly 1 percent for the day to $1,046.

Amazon shares have been trading at a record high. They hit $1,083.31 at about noon Thursday. According to securities filings, Bezos owns about 80 million shares, or 17 percent; those shares were valued at more than $87 billion at the peak. Bezos also owns The Washington Post through a holding company.

Forbes said Bezos’ net worth was about $90.6 billion when the market opened Thursday. Gates had $90.1 billion. Forbes said Gates would have been the undisputed leader had he not given billions of dollars away to various philanthropic causes.

Bezos issued a request for philanthropic ideas in a tweet in June, just before Amazon announced a $13.7 billion deal for organic grocer Whole Foods.

Shares of Seattle-based Amazon has surged 40 percent this year through Wednesday, helping to add $24.5 billion to the net worth of Bezos, 53. He started 2017 as the world’s fourth-wealthiest person.

The changes in Bezos’ fortune coincided with Amazon’s report of a 77 percent decline in quarterly profit on heavy spending.

advertisement | advertise on newsday

Amazon has long been known for investing the money it makes back into its businesses.

In a conference call, Amazon Chief Financial Officer Brian T. Olsavsky said that Amazon will continue to open new warehouses to fulfill orders, even though sales tend to slow down in the third quarter before rising again during the holidays. He also said Amazon has been spending more to acquire video for its streaming service and to lease properties for data centers to meet growth in its cloud-services business.