SAN FRANCISCO (Reuters) - Apple Inc reclaimed the throne as the world’s top smartphone seller for the first time in five years on Tuesday, beating out rival Samsung in units shipped for the holiday quarter and boosting revenues with a strong showing for its new, top-of-the-line iPhone 7 Plus.

The iPhone sales numbers, and a profit of almost $18 billion, both handily beat Wall Street expectations, sending its shares up 3 percent in after-hours trading.

But the gains were tempered by Apple’s cautious outlook for the current quarter, which it mainly attributed to the strong U.S. dollar, which hurts companies like Apple that sell a majority of their products overseas, by forcing them to raise prices, which depresses unit sales, or sacrifice margins.

Apple sold 78.29 million iPhones in the fiscal first quarter ended Dec. 31, up from 74.78 million the year before. Analysts on average had expected 77.42 million, according to research firm FactSet StreetAccount.

That beat Samsung Electronics’ 77.5 million smartphone sales in the quarter, according to tech data firm Strategy Analytics, the first time that has happened since the fourth quarter of 2011.

The results, which reflected the first full quarter of iPhone 7 sales, come at a time when global demand for smartphones is slowing and cheaper Android alternatives are flooding the market. Apple may also have benefited from Samsung’s much-publicized recall of the its fire-prone Galaxy Note 7.

Apple is heavily dependent on the success of iPhones, which account for more than two-thirds of its total revenue.

Analysts and investors have already set their sights on Apple’s 10th-anniversary iPhone, which is expected to feature better touchscreen technology, wireless charging and a shift to a higher-resolution OLED display.

Apple Chief Executive Tim Cook said demand was especially high for the larger iPhone 7 Plus in the fiscal first quarter.

Slideshow ( 3 images )

Revenue in the services business - which includes the App Store, Apple Pay and iCloud - jumped 18.4 percent to $7.17 billion, helped by the popularity of games, including Pokemon Go and Super Mario Run, and increased revenue from subscriptions.

OVERSEAS CASH

Cook, who met with lawmakers in Washington last week, said he was “optimistic, given what I am hearing” that there would be changes to the corporate tax reform this year that would allow Apple to bring more than $200 billion in offshore cash back to the United States.

“What we would do with it, let’s wait and see,” Cook told analysts in response to a question. “We are always looking at acquisitions... There’s not a size we wouldn’t do just based on the size of it. It’s more about the strategic value.”

Apple is still looking for major new sources of growth as Apple TV struggles to set itself apart from competitors and its plans to enter the autonomous driving market take shape. The company said Apple Watch sales set a record last quarter, but provided no numbers.

Analysts expect growth in services to help offset declining hardware sales as the smartphone market matures. The services business also has gross margins that are higher than Apple’s overall company average, which could help offset the extra cost of new features like the OLED screens while still meeting an overall gross margin target of between 38 percent and 39 percent.

“That’s a very high-margin business that is helping Apple navigate its innovation,” said Anil Doradla, an analyst with William Blair & Co.

Cook said on Tuesday that he expects services revenue to double in the next four years as the installed base of iPhones and iPads continues to grow.

Slideshow ( 3 images )

CHINA FALLS

While Apple’s revenue from the Greater China region fell 11.6 percent to $16.23 billion for the quarter, Chief Financial Officer Luca Maestri cast the numbers as positive.

“We were encouraged by our performance in China because it was clearly an improvement over the last couple of quarters. In mainland China in particular, our revenue was flat and actually grew in constant currency terms,” Maestri said.

The company forecast revenue of between $51.5 billion and $53.5 billion for the current quarter. Analysts, on average, expect revenue of $53.79 billion, according to Thomson Reuters I/B/E/S.

The rate at which previous Apple customers buy new phones was the same as last year in international markets, executives said, without giving specific numbers. Maestri said the company has had to raise prices as much as 40 percent in some markets. “Clearly, this issue of the strong dollar doesn’t help us,” Maestri said.

Analysts on average expect the company to sell 53.43 million iPhones in the current quarter, according to FactSet.

For the holiday quarter reported on Tuesday, net income fell to $17.89 billion from $18.36 billion the year before. On a per share basis, it earned $3.36, beating the average analyst estimate of $3.12, according to Thomson Reuters I/B/E/S.

Revenue rose 3.3 percent to $78.35 billion, compared with the average analyst estimate of $77.25 billion.

Up to Tuesday’s close, Apple’s shares have gained about 15 percent since mid-November, compared with the 5.3 percent rise in the Dow Jones Industrial Average.