Amazon and Apple posted better than expected sales, reassuring investors that the tech giants will be able to weather slowdowns in global economies.

Amazon forecast in a trading update that higher fees for its Prime membership would boost its bottom line, while Apple said demand for its all important iPhone remained strong.

Both firms said they were making progress controlling running costs, despite prices rising at rapid rates.

The updates sent shares soaring.

The quarterly updates from Apple and Amazon are closely watched as indicators of how customers are reacting to the economic climate.

On Thursday, official figures revealed the US economy shrank for the second quarter in a row, a milestone that in many countries would be considered an economic recession, but not in the US, which uses additional data to make that call.

US economy shrinks again sparking recession fears
Amazon raises Prime subscription price
"Our June quarter results continued to demonstrate our ability to manage our business effectively despite the challenging operating environment," said Apple's chief operating officer Luca Maestri, adding the company expected growth to pick up again in the months ahead.

However, both companies have seen sales growth slow sharply from last year and profits fall.

Apple's profits dropped almost 11% from a year ago to $19.4bn (£15.9bn), as it wrestled with Covid-19 lockdowns in China, while Amazon lost $2bn, hit by changes to the value of its investment in electric carmaker Rivian Automotive.

Apple boss Tim Cook said the company was seeing a "mixed bag" of economic signals, with iPhone demand holding steady but areas like digital advertising slipping.

"When you think about the number of challenges in the quarter, we feel really good about the growth that we put up," he said.

Overall, sales of Apple products and services rose 2% year-on-year between April and June to $83bn. Sales of iPhones continued to power the company's gains, as supply constraints held back sales of other products.

Its services business, which includes Apple Pay and its streaming music and television services, also grew 12%.

Meanwhile, Amazon said its revenues were up 7% to $121.2bn, despite its e-commerce business being hit in recent months. Online sales shrank 4%, the second quarter in a row of decline.

But the company continues to be shielded by the strength of its clouding computing division, AWS, which saw sales soar by 33%.

In spring Amazon spooked investors, as its online sales softened and it warned it had spent too heavily to hire and add warehouses in a bet that pandemic-era shopping patterns would continue.

But it provided a more optimistic outlook this time.

"Despite continued inflationary pressures in fuel, energy, and transportation costs, we're making progress on the more controllable costs we referenced last quarter, particularly improving the productivity of our fulfilment network," said chief executive Andy Jassy.

Amazon said its e-commerce sales were poised to look especially weak because Prime Day, when discounts typically drive a surge of buying, was moved from June to July.

'Mixed bag'
"Big tech's been a mixed bag this earnings season, but Amazon proved that the strong can survive even the toughest environments," said Laura Hoy, equity analyst from Hargreaves Lansdown.

Apple and Amazon are too big not to be affected by signs of slowdown in the global economy, said Scott Kessler, global sector lead at Third Bridge.

But their size gives them somewhat unique power to navigate those challenges, particularly when it comes to negotiating prices.

"Apple's done an excellent job of managing those costs - it doesn't hurt that they're typically one of the biggest purchasers," he said.

However, Christie Pitts, a general partner at tech fund Backstage Capital, told the BBC that Amazon saw some pressure on its results, in part due to the impact of inflation, "as consumers have less discretionary money to spend on impulsive purchases".