Apple on Tuesday reported first-quarter revenue that managed to just surpass the company’s own lowered estimates as it saw one of its biggest year-over-year declines in iPhone sales.

Following the close of trading, Apple said it earned $4.18 a share, on $84.3 billion in sales, for the quarter ending Dec. 29. During the year-ago period, Apple earned $3.89 a share, on revenue of $88.3 billion.

By managing to eke out a small improvement over its revenue outlook, Apple gave investors a bit of breathing room in after-hours trading — its shares climbed 4.7 percent, to $163.10.

On Jan. 2, Apple lowered its sales outlook for the quarter to $84 billion from a prior estimate of $89 billion to $93 billion, due in large part to weakness in its business in China and lower-than-expected sales of iPhones.

In fact, iPhone revenue fell to $52 billion, a 15 percent decline from the $61.1 billion it reported in the first quarter a year ago. Apple’s sales from what it calls “Greater China” plunged by almost 27 percent, to $13.17 billion.

Speaking on a conference call to discuss Apple’s results, Chief Executive Officer Tim Cook said it was “disappointing to miss our revenue guidance,” but added that “we manage Apple for the long term, and this quarter’s results demonstrate that the underlying strength of our business runs deep and wide.”

While iPhone revenue declined, Apple was able to point to its services business sales rising 19 percent, to $10.9 billion, as an example of the company’s growth in non-iPhone areas. Sales of iPads rose by almost 17 percent, to $6.73 billion, and Mac computer revenue grew almost 9 percent, to $7.42 billion.

Analysts that follow Apple said that while they don’t think the bottom has fallen out on the company, Cook and company do have some work ahead of them in order to restore the sheen acquired from years of booming iPhone sales.

“There were some bright spots but because the iPhone makes up so much of Apple’s revenue stream those bright spots are overshadowed,” said Rob Enderle, president of tech consultancy for the Enderle Group. “They need greater product diversity, and they also need to up their efforts with regard to demand generation before they start hitting limitations on what people are willing to pay for Apple services and hardware.”

Tim Bajarin, president of tech research firm Creative Strategies, said that the China factor is likely to weigh on Apple this year. However, he thinks the company will be able to use its product line to steer through some of the difficulties and uncertainties of the trade situation that is still simmering between China and the United States.

“2019 will be a difficult year for Apple, and most tech companies, based on lower demand and tariff and trade issues with China, as well as challenges to the world economy,” he said. “But Apple, most likely, has a lot of new products and services coming out this year that should help them navigate these global issues and remain a strong and successful company.”

For its current, fiscal second quarter, Apple said it expects sales to be anywhere from $55 billion to $59 billion.