NEW YORK (AP) — Amazon posted higher fiscal second-quarter profit and sales than the year-ago period, underscoring the online giant’s resilience despite tariff uncertainty.

The Seattle-based company also offered on Thursday a sales outlook for the current quarter that beat analysts’ projections. Still, its shares fell nearly 7% in after-market trading as the company’s estimates for operating income for the current quarter were below analysts’ views.

The company reported 17.5% growth for its prominent cloud computing arm Amazon Web Services.

The results come even as uncertainty about President Donald Trump’s tariffs have challenged companies and consumers. But Amazon and other large retailers have tried to beat the clock by bringing in foreign goods before Trump’s tariffs took effect. Amazon, like many other big retailers, also has the clout to negotiate prices with its suppliers and a broad breadth of items.

Amazon’s CEO Andy Jassy told investors that while there’s lots of noise about the impact of tariffs on retail prices and consumption, he said “it’s impossible to know what will happen.” That’s because, in part, no one knows where tariffs will finally settle, especially in China, he said.

“If costs end up being higher, we will absorb them, but what we can share is what we’ve seen thus far, through the first half of the year, we haven’t yet seen diminishing demand nor prices meaningfully appreciating,” he said.

Jassy also touted the diversity of its more than 2 million sellers in its third-party marketplace, all with different strategies of whether to pass on higher costs to shoppers.

Meanwhile, Amazon is one of the biggest players in the race around generative artificial intelligence.

Like other tech companies, it has increased investments in the technology and is spending billions to expand data centers that power AI and cloud computing. The company is also investing in its own computer chips and those developed by Nvidia. It has also expanded its own AI models and integrated generative AI into other parts of its business.

In March Amazon began testing AI-aided dubbing for select movies and shows offered on its Prime streaming service. A month earlier, the company rolled out a generative-AI infused Alexa.

Jassy anticipates generative AI will also allow Amazon to reduce its corporate workforce in the next few years.

The company is also making big investments in expanding its delivery network to bring faster delivery to customers in less densely populated areas across the U.S. Jassy told investors Thursday that the service is available in 1,000 of the more than 4,000 smaller cities, towns and rural communities targeted by year-end. He noted the early response has been “positive,” with customers shopping more frequently and purchasing household essentials.

Amazon earned $18.16 billion, or $1.68 per share, for the quarter ended June 30. That’s up from $13.49 billion, or $1.26 per share, in the year-ago period.

Revenue rose to $167.7 billion from $147.9 billion a year ago.

The company’s sales figure excluded the impact from Amazon’s Prime Day event, which ran from July 8 to July 11. For the first time, Amazon held Prime Day over four days instead of two.

Analysts expected earnings per share of $1.33 on sales of $162.19 billion for the quarter, according to FactSet.

The company said it expects sales for the current quarter of between $174 billion and $179.5 billion. Analysts expected $173.27 billion for the current quarter, according to FactSet.

However, Amazon said that operating income is expected to be between $15.5 billion and $20.5 billion for the third quarter, compared with $17.4 billion in the third quarter of 2024. Analysts expected $19.5 billion for the current quarter, according to FactSet.