Amazon reported its first quarterly loss since 2015, its money-making juggernaut stalled by a slowdown in pandemic-induced online shopping and a huge write-down of its investment in an electric-vehicle startup.

Amazon reported a loss of $3.84 billion, or $7.56 a share, for the first three months of the year. A year ago, it reported a profit of $8.1 billion, or $15.79 a share, for the first quarter. Wall Street analysts expected a profit of $8.35 a share in the latest quarter, according to FactSet.

The ocean of red ink in Amazon's report came mostly from the company's accounting for a $7.6 billion loss in value of its stock investment in Rivian Automotive. Rivian went public in late 2021 and its stock traded at close $180 at one point. It closed Thursday at $32.18. Ford Motor Co. reported a similar write-down of the value of its Rivian investment Wednesday.

Amazon's e-commerce business also reported an operating loss of $1.57 billion in North America and $1.28 billion internationally.

Meanwhile, sales at Amazon's cloud-computing business, which helps power the online operations of Netflix, McDonald's and other companies, grew 37% in the quarter. And sales in its advertising business, where brands pay to get their products to show up first when shoppers search on Amazon's site, rose 25%.

Still, the slowdown in online spending is real and broad-based. While in-store sales rose, March is the first month to show decline in online sales since the pandemic began, according to Mastercard SpendingPulse, which tracks spending made over the Mastercard payments network and survey estimates for other payments made with cash and checks.

Amazon prospered during the COVID-19 pandemic as homebound people eager to limit human contact turned online to purchase what they need. But growth has slowed as vaccinated Americans feel more comfortable going out. According to the e-commerce research firm MarketPlace Pulse, the value of goods sold on Amazon last year grew by half the rate compared to 2020.

Like many others, Amazon is dealing with pressure from inflation and supply-chain issues. In the past two years, Amazon's Chief Financial Officer Brian Olsavsky said the company has doubled the size of its operations and nearly doubled its workforce. He said labor shortages and a lack of physical space are no longer major issues, but the company continues to face a variety of pressures such as increased shipping costs.

Inflation-related expenses added roughly $2 billion of incremental costs when compared to last year, Olsavsky said, adding that the company also incurred another $4 billion in costs related to productivity loss and other inefficiencies.

"The pandemic and subsequent war in Ukraine have brought unusual growth and challenges," said Amazon CEO Andy Jassy in a statement. "Our teams are squarely focused on improving productivity and cost efficiencies throughout our fulfillment network. We know how to do this and have done it before."

To offset rising fuel costs and inflation, the retail giant has added a 5% surcharge to fees it charges third-party sellers who use its fulfillment services. Last quarter, Amazon also hiked its annual Prime membership fee by $20, a first since 2018. Despite the fee hike, Olsavsky said millions of new Prime members have enrolled during the quarter.

Revenue rose 7% to $116.44 billion, compared with $108.52 billion in first quarter 2021, representing the company's sixth consecutive quarter of revenue topping $100 billion. Amazon had projected sales between $112 billion and $117 billion. Analysts surveyed by FactSet were expecting $116.5 billion.

"Given the pace at which the business grew over the past few years this shift is hardly surprising," said Neil Saunders, managing director of GlobalData Retail. "It represents more of a post pandemic reset than catastrophic failure. Nevertheless, the slowdown raises important questions over how Amazon can restore momentum and regain its leadership position as one of the primary drivers of online growth."

Amazon said it forecasts sales for the current quarter to range between $116 billion and $121 billion, below the $125.33 billion that analysts are forecasting.

The results come as Amazon is closing all of its brick-and-mortar bookstores, as well as its 4-star shops and pop up locations, as the online retail behemoth reworks its physical footprint. The company also faces a growing unionization push from inside its workforce.

A second union election is currently underway at a company warehouse on Staten Island, New York, the same borough where workers at a nearby facility voted to unionize earlier this month. Amazon has filed objections over the election with the National Labor Relations Board and is seeking to re-do the vote.

The final outcome of a separate union election in Bessemer, Alabama, is still up in the air with 416 outstanding challenged ballots hanging in the balance. Hearings to review the ballots are expected to begin in the coming weeks.

Haleluya Hadero reports for the Associated Press. AP writer Anne D'Innocenzio contributed to this report.

Copyright 2022 AP. All rights reserved. This material may not be published, broadcast, rewritten, or redistributed.