Apple's quarterly profit and revenue beat Wall Street targets on Tuesday and its forecast for fourth-quarter sales topped expectations as well, with Chief Executive Tim Cook telling Reuters that "marked improvement in greater China" drove the results.

Services revenue in the fiscal third quarter rose 12.6 percent to $11.46 billion, a new record, but missed expectations of $11.73 billion, according to IBES data from Refinitiv. Apple CEO Tim Cook told Reuters that after factoring out a one-time payment from lawsuits a year ago and foreign-exchange effects, the services segment growth rate would have been 18 percent.

China sales fell 4 percent to $9.16 billion, after declining 22 percent in the fiscal second quarter. The Chinese smartphone market shipments declined 6 percent in Apple's fiscal third quarter, according to market research firm Canalys.

Trade tension between the United States and China have weighed heavily on Apple because it has slowed down economic growth in China, a major market for Apple. Apple effectively cut iPhone prices in China earlier this year after currency exchange rates had made its phones too expensive for many Chinese consumers.

Cook told Reuters that results for mainland China, a subset of Apple's greater China region, were positive.

"We actually grew in mainland China," Cook told Reuters. "Non-iPhone revenue grew 17 percent. We grew in every category outside of iPhone."

Apple said it expects revenue for the current fiscal fourth quarter of between $61 billion and $64 billion, compared with analyst estimates of $61.02 billion.

For the fiscal third quarter ended in June, Apple reported a 1 percent rise in revenue to $53.8 billion and a 7 percent drop in earnings per share to $2.18, compared with expectations of $53.39 billion and $2.10 per share, according to Refinitiv data. IPhone sales fell 12 percent to $25.99 billion, about in line with expectations of $25.96 billion, according to Refinitiv data. (Graphic: https://tmsnrt.rs/2yAEoCh)

"In regards to iPhone, the most important thing for us is that we continue to grow the installed base," Cook told Reuters. "And we did that on iPhone. And so the fact that people are hanging onto them a little longer, it's not something I worry about in the 90-day clock."

Apple did not give the number of installed bases of Apple devices but said it grew.

Trade tension looms

Apple reported results as U.S. and Chinese trade negotiators met in Shanghai for their first in-person talks since a G20 truce last month, after which U.S. President Donald Trump said he would not impose new tariffs on a final $300 billion of Chinese imports if China agreed to make purchases of U.S. agricultural products.

Apple's most important products, such as the iPhone, are primarily made in China but so far have avoided tariffs. But the iPhone would be included in the final $300 billion round as it is currently written.

"I don't know what the journey will be, but over time I'm optimistic that we'll all get to a good conclusion and everybody will win from it," Cook told Reuters when asked about the trade talks.

Apple's market share in China declined to 5.8 percent from 6.4 percent, according to market research firm Canalys, in part because smartphone rival Huawei Technologies Co Ltd gained market share to become the top handset seller in the country.

But Apple experienced a smaller market share loss than competitors such as Xiaomi Corp, Oppo and Vivo, according to Canalys data. Cook said that iPhone price adjustments, plus the Chinese government's move to cut phone taxes, helped keep iPhone sales in China from eroding further.

"Our trade-in and financing programs are doing extremely well in China," Cook told Reuters. "Because of the active installed base is growing in China, our services business is doing very well, growing double digits."

Apple shares have gained more than 20 percent since early June, when shares dropped on news that the U.S. Department of Justice had jurisdiction over the company in a potential probe as part of a broader review of whether technology giants engage in anticompetitive practices.

The Justice Department formally announced the review last week but did not name any companies that would be scrutinized. Officials said the efforts would focus on “search, social media, and some retail services online,” an apparent reference to Alphabet Inc, Amazon.com Inc and Facebook Inc rather than Apple specifically.

But Apple has faced complaints from competitors and developers over its practice of keeping 15 percent to 30 percent of revenue earned by developers on its App Store. In March, Spotify Technology SA, Apple's chief rival in the streaming music space, filed an antitrust complaint against Apple with European Union officials.

Apple's services, which include Apple Music, the App Store and iCloud, are seen as a source of growth for Apple as iPhone sales have slowed. In the coming months Apple plans to release a credit card and subscription services for gaming and television.

Apple said revenue for its "Wearables, home and accessories" segment that contains devices like the Apple Watch and AirPods was $5.53 billion, compared with analyst estimates of $4.81 billion.

Apple said it returned more than $21 billion to shareholders during the fiscal third quarter, including $17 billion in share repurchases. It declared a dividend of 77 cents per share.