A surge in iPhone sales, especially in China, has led to a doubling of profits at Apple since the start of the pandemic.

The results reflected “optimism” about the days ahead, Apple’s boss said.

Rival tech firm Facebook also reported bumper revenues and profits.

But the social media giant warned Apple’s latest software release could undermine its prospects later in the year.

Apple has seen sales of its phones, apps and other devices rise throughout the pandemic, as consumers spent more time working, shopping and seeking entertainment online.

Customers continued to upgrade to Apple’s new 5G phones which were rolled out last year, and also bought Mac computers and iPads to tackle working and studying from home, the firm said.

Fitness and music apps also saw a lockdown boost.

Sales to China nearly doubled, leading to overall revenues for the first three months of this year of $89.6bn (£64.2bn), more than 50% up compared to a year earlier.

Profit was $23.6bn, up from $11.3bn for the same period last year.

“This quarter reflects both the enduring ways our products have helped our users meet this moment in their own lives, as well as the optimism consumers seem to feel about better days ahead for all of us,” said chief executive Tim Cook.

Paolo Pescatore, analyst with PP Foresight, said it was “another blowout quarter” for Apple.

“The iPhone remains a core product and gateway to the Apple universe,” he added, providing Apple with “a key launchpad” to sell further services.

Sophie Lund-Yates, Equity Analyst at Hargreaves Lansdown said customers had proved willing to “splurge on big-ticket items thanks to a global shift to working from home, and the fact people have found comfort in treating themselves”.

“The sheer scale of Apple’s sales is testament to the grip that shiny embossed piece of fruit has on global consumers,” she added.

Facebook, which relies on sales of advertising rather than consumer electronics, also saw bumper revenues and profits in the first three months of the year.

The time spent by consumers at home, and the spending power that shifted online, translated into revenues of $26.17bn, outpacing analysts predictions. Profit was also higher than expected at $9.5bn.

Facebook said in coming months it expected revenue to be stable or grow moderately, and admitted a new feature released this week by Apple – an option for users to prevent apps from collecting user data – could “significantly” hurt its business.

Analysis box by James Clayton, North America technology reporter

It’s not just Apple and Facebook who have posted astonishing profits this week. Google and Microsoft announced eye-watering quarterly figures yesterday too.

That may not be surprising to many. Global lockdowns have made people work and play more online. What’s less clear though was whether this was a pandemic bounce? Or have people permanently changed their behaviour? These figures certainly suggest the latter.

Apple’s figures across multiple sectors, across the world, are exceptional. In places like China, which has mostly been lockdown-free in recent months, sales were up dramatically. Facebook’s figures too, show that advertisers are feeling bullish about online spending.

Almost all of Facebook’s revenue is from ads, so when Facebook is doing well, that usually suggests we’re buying more things on the internet. Amazon’s quarterly figures are out tomorrow, and they too are expected to have had a bumper quarter. Big Tech’s pandemic bounce is increasingly looking like a trend.

The two companies are locked in a stand-off after Apple announced the latest version of its iOS operating system this week.

A new feature will prompt device users to decide whether they are happy for their data to be collected by apps. Many are likely to say no.

But user data is a large reason why Facebook’s ad-based business model is so profitable. It allows advertising to be targeted and monitored for efficacy.

Facebook saw a rise in monthly active users, however, which were up by 10% at 2.85 billion.

On Tuesday Google’s parent company Alphabet reported a record profit in the three months to March as its advertising revenue swelled by a third.

The firm credited “elevated consumer activity online” for its results as populations around the world spent more time indoors at home to avoid the spread of coronavirus.