Amazon's e-commerce business perked up in the three months to June, after months of lacklustre spending amidst a wider, sluggish economy.
The uptick follows a push by boss Andy Jassy to make the online shopping giant's delivery network run faster and more smoothly, the firm said.
It helped to drive overall sales up 11% year-on-year to a better-than-expected $134.4bn (£105.4bn).
Amazon's July Prime Day was its biggest ever, with 375 million items purchased.
The company surpassed analyst expectations, with quarterly profits of $6.7bn (£5.2bn), up from a $2bn loss a year earlier. That was the firm's biggest profit in more than a year.
Boss Andy Jassy said the results showed "another strong quarter of progress".
Though known for its online shopping operation, Amazon's financial results are driven far more by units such as its cloud computing business, called AWS, and - in more recent years - advertising.
It said that AWS's sales had stabilised, rising 12% year-on-year, as businesses become less worried about the economy. Advertising revenue jumped 22% year-on-year.
The update comes as a string of other data suggests that some of the darkest clouds over the global economy may be starting to lift.
The company's executives said consumers were still keeping a close eye on their budgets, which in many countries have been squeezed as prices rise at the fastest pace seen in decades.
But those increases have shown signs of cooling more recently.
Amazon's online sales rose 4% year-on-year in the April to June period, after no growth at the start of the year, the company said.
The upturn in Amazon's ecommerce business is an "encouraging sign" for the rest of its year, said Insider Intelligence's principal analyst Andrew Lipsman.
Even its international business, which was posting declines a year ago, reported sales growth, of roughly 10%.
Amazon has been pushing to hold onto its dominance in online shopping, since the huge growth it experienced during the pandemic had slowed.
Mr Jassy, who took over as chief executive two years ago, has focused on trimming costs and improving efficiency, leading to big job cuts and an overhaul of the firm's delivery network. It has meant that orders are routed regionally, closer to the customer.
He said the firm was still making big investments, including in artificial intelligence: a top interest on Wall Street, where discussions about the potential for transformation from new advances have fuelled a surge in share prices.
Amazon's share price had already surged roughly 50% so far this year. After Thursday's update, share were up more than 7% in after-hours trade.
"As ever, Amazon's real strength comes from the breadth of its ecosystem," said Julian Skelly, managing partner at digital consultancy Publicis Sapient, Europe.
"Looking forward, the signs of slowing inflation and broader growth in the market suggest that we can hope for better-than-anticipated performance in the second half of 2023," Mr Skelly added.