Customers shop in an Apple store in Pittsburgh Jan 30, 2023. Apple reports its earnings on May 4, 2023. (PHOTO / AP)

Apple Inc's results beat expectations on Thursday, showing off the tech giant's resilience in a slowing global economy thanks to better-than-expected iPhone sales and notable inroads in India and other newer markets.

Shares of the largest US company by market value rose 2 percent after Apple exceeded Wall Street's expectations for revenue and profit for the April 1 quarter. The company's results contrast with disappointing figures out of big chipmakers due to a slower-than-expected rebound in China's economic growth.

Apple said sales for its fiscal second quarter ended April 1 fell 2.5 percent to $94.8 billion, ahead of expectations for a 4.4 percent decline, according to Refinitiv data. Profit was flat at $1.52 per share, compared with estimates of $1.43 per share

Apple executives on Thursday said gross profit margins for the current quarter would be better than forecast despite an expected dip in revenue as supply-chain issues have improved.

Apple said sales for its fiscal second quarter ended April 1 fell 2.5 percent to $94.8 billion, ahead of expectations for a 4.4 percent decline, according to Refinitiv data. Profit was flat at $1.52 per share, compared with estimates of $1.43 per share.

IPhone sales were up 1.5 percent to $51.3 billion, besting expectations for a 3.3 percent drop even as consumers and businesses tightened up spending due to rising inflation. Global smartphone shipments fell 13 percent during the first three months of 2023, according to research firm Canalys, which said Apple gained market share against Android rivals.

Chief Financial Officer Luca Maestri said Apple's gross margin will be between 44 percent and 44.5 percent, above estimates of 43.7 percent, according to Refinitiv data. But he also said Apple's revenue will likely decline slightly. Analysts were expecting a 2.1 percent increase to $84.7 billion for the company's June-ending fiscal third quarter.

ALSO READ: Apple to invest another $200 million in carbon removal fund

Apple's stock has outperformed most of Wall Street in 2023, up 28 percent year-to-date. Investors see the company as a defensive play during a time of economic uncertainty.

Apple raised its dividend to 24 cents a share, up from 23 cents a share a year ago. The board authorized a $90 billion share repurchase program, same as a year ago.

Emerging markets outperform

Sales of Macs fell sharply while iPad revenue slipped. Sales in China also dropped 2.9 percent, a slightly larger drop than overall revenue

Apple CEO Tim Cook told Reuters in an interview on Thursday that the company set a fiscal second-quarter record for iPhone sales, thanks in part to picking up new users in markets such as India, where Cook recently traveled for the opening of that country's first Apple stores.

"We were thrilled by our performance in emerging markets," Cook said. "We set records for the iPhone installed base in every geographic segment, and we had very strong 'new to' (sales in) emerging markets, particularly in Brazil, India and Mexico."

Cook also said supply-chain snarls have vanished. "We had no material shortages at all during the quarter across any of the products."

Not all of Apple's business lines were immune to the electronics slump. Sales of Macs fell sharply while iPad revenue slipped. Sales in China also dropped 2.9 percent, a slightly larger drop than overall revenue.

READ MORE: Apple rolls out Macbooks with new M2 chips in rare Jan launch

Sales in Apple's wearables business, which includes devices like AirPods and the Apple Watch, fell less than 1 percent compared with estimates for a 4.4 percent drop

"Apple still needs China on a near-term basis to drive sales and profits," said Tom Forte of DA Davidson. "Long-term, emerging markets are important, especially India from a supply chain and sales standpoint."

Other tech firms have predicted a second-half rebound. Wall Street expects Apple to recover faster and show modest year-over-year revenue growth during its fiscal third quarter ending in June.

Investors are still waiting for the company's next major hardware product. Bloomberg has reported the iPhone maker could unveil a mixed-reality headset as soon as next month, when it holds its annual software developer conference. The company recently announced new service businesses such as a high-yield savings account.

ALSO READ: Report: Apple faces obstacles to boost India manufacturing

iPhones are on display during a press preview of India's first Apple Store in Mumbai, India, Monday, April 17, 2023. Apple CEO Tim Cook said on May 4, 2023 that the company set a fiscal second-quarter record for iPhone sales, thanks in part to picking up new users in markets such as India. (PHOTO / AP)

Mac sales fell more than 30 percent compared with analyst estimates of a 25 percent decline, according to Refinitiv. Apple's sales fared only slightly better than PC unit shipments in the market, which fell 33 percent in the calendar first quarter, according to Canalys.

Sales in Apple's wearables business, which includes devices like AirPods and the Apple Watch, fell less than 1 percent compared with estimates for a 4.4 percent drop.

Apple's biggest growth segment was its services business, which includes products like iCloud and Apple Pay, which grew 5.5 percent to $20.9 billion. Cook said Apple now has 975 million subscribers on its platform, which includes both Apple services and third-party apps, up from 935 million last quarter and an increase of 150 million from a year ago.