(Reuters) - Apple Inc said sales in China were stabilizing and touted how increasing demand for services and accessories such as Apple Music and the Apple Watch helped offset a record drop in iPhone revenue.

Sales of iPhones, which account for more than half of all revenue, fell 17% in the fiscal second quarter from a year earlier and slightly missed analyst expectations.

After Apple slashed prices in China, iPhone sales picked up toward the end of the quarter and revenue rose from iPads, wearables and services. While consumers may be putting off phone purchases longer than in the past, they are deepening ties with the Cupertino, California company’s brand.

Shares, which have mostly recovered from an end-of-year sell-off, are rising toward a new high. They gained more than 5% in after-hours trading after Apple announced the results and plans for a new $75 billion share buyback. (Graphic: tmsnrt.rs/2WdDgyh)

Apple said it expects revenue between $52.5 billion and $54.5 billion for the current quarter ending in June, above analysts’ average estimate of $51.93 billion, according to IBES data from Refinitiv.

In an interview, Apple Chief Executive Tim Cook said that iPhone sales started to strengthen during the last few weeks of the fiscal second quarter, including in China. “These, along with the continued success with wearables and so forth, give us some confidence that things are getting a bit better,” Cook told Reuters in an interview.

Apple reported net earnings per share of $2.46 for the March quarter, down about 9.9% from a year earlier, compared with Wall Street’s average estimate of $2.36. Actual net income declined 16.3% to $11.56 billion. Apple spent a record $27 billion on share buybacks and dividends during the fiscal second quarter. Buybacks boost earnings per share by cutting the number of shares outstanding.

FILE PHOTO: A 3D printed Apple logo is seen in front of a displayed stock graph in this illustration taken April 28, 2016. REUTERS/Dado Ruvic/Illustration

Apple said iPhone revenues were $31.05 billion, slightly below analyst estimates of $31.10 billion, according to data from FactSet.

But revenue from wearables and accessories sales of $5.13 billion beat estimates of $4.79 billion, according to FactSet data. And services revenue, which includes sales from iCloud, the App Store and other businesses, reached $11.45 billion, compared with analyst estimates of $11.32 billion, according to FactSet.

Apple has wrestled with a slowdown in iPhone sales in key markets such as China and saw its first ever year-over-year decline in iPhone revenue for the holiday shopping season.

The slowdown stemmed in part from the iPhone’s high cost and competition from rivals such as Huawei Technologies Co Ltd, Xiaomi Corp, Oppo and Vivo - all of which sell cheaper phones with features similar to the iPhone.

But Cook said price adjustments in China, along with lower Chinese taxes on the iPhone and the trade-in and financing deals Apple offered, helped iPhone sales start to recover toward the end of the quarter. Cook also said he is “optimistic” that the United States and China will soon reach a trade deal.

“The trade relationship, versus the previous quarter, is better. The tone is better,” Cook told Reuters. “The sum of all of this together, it helped us.”

Investors are looking to Apple’s services business to fuel growth as iPhone sales slow. Last month, Apple revealed a new credit card offering and subscription services for news, television and gaming, though only the news subscription is currently available to purchase.

Apple on Tuesday said it has 390 million total subscribers to both its own and third-party services on its devices. The company has set a goal of 500 million by 2020.

Tom Plumb, founder of Wisconsin Capital Management and an Apple shareholder, said the results looked good, especially the uptick toward the end of the quarter. But other shareholders such as Brian Pirri, a principal at Apple shareholder New England Investment and Retirement Group, said they took the results with a “grain of salt” because expectations were low heading into the report.

“I don’t think the phones are the answer. (Apple) is going to need to continue to innovate, and I don’t see a ton out of this report that excites me,” Pirri said.

For its fiscal second quarter ended in March, Apple reported revenue of $58.02 billion, above analysts’ average estimate of $57.37 billion, according to Refinitiv data.

Apple also said its board had authorized an additional $75 billion in share repurchases and raised its dividend by 5 percent.

“I imagine people are extrapolating the positive developments in China near quarter end and looking forward to a better environment there,” said Hal Eddins, chief economist at Apple shareholder Capital Investment Counsel. “For me, the driver for tonight’s (share price) move is the dividend hike ... and more importantly the $75 billion buy back. Either way, I’ll take it.”

(Graphic: Apple Earnings link: here).