Apple has returned to growth as it sold more expensive iPhones, but the company's future is less certain than analysts thought. The company's stock popped in after-hours trade following its quarterly earnings report. The iPhone maker reported quarterly earnings and revenue that easily beat analysts' expectations on Tuesday, but gave future guidance on the lower end of expectations. EPS:$3.36 vs. $3.21 expected by a Thomson Reuters consensus estimate

Revenue: $78.4 billion vs. $77.25 billion expected

iPhone shipments: 78.29 million vs. 77.42 million expected by StreetAccount estimates

Services revenue: $7.17 billion vs. $6.91 billion expected by StreetAccount

Fiscal Q2 guidance: Revenue of $51.5 billion to $53.5 billion, vs. $53.79 billion expected by Reuters That's better than comparable adjusted earnings of $3.28 per share on $75.9 billion in revenue in the year-ago period, breaking a losing streak for the company.

Tim Cook, chief executive officer of Apple speaking with dancer Maddie Ziegler during an Apple event in San Francisco. David Paul Morris | Bloomberg | Getty Images

This time last year, Apple reported a record quarter, with sales of iPhones at an all-time high. After that, it reported three straight quarters of lower year-over-year sales, adding up to its first yearly decline since 2001.

CEO Tim Cook said on a conference call with investors there was especially strong demand for the iPhone 7 Plus —Apple's higher-end model — and that it made up a higher-than-expected share of sales. The average selling price of phones grew to $695 during the quarter, chief financial officer Luca Maestri said, up from $619 in the September quarter. The Mac also returned to growth, and posted its best sales ever, Cook said.

"It was a dynamite quarter," CEO Cook told CNBC. "We are very excited about our pipeline."

Shares rose more than 3 percent after hours. Apple's board of directors also declared a cash dividend of 57 cents per share. The world's biggest company had a massive cash pile of $246.09 billion during the quarter — larger than Sri Lanka's estimated 2016 gross domestic product — and $27 billion in operating cash flow. It's services revenue is now about the size of Facebook's revenue last quarter.

Looking ahead, Apple is promising a sustained trend of year-over-year growth. Apple said on Tuesday it expects revenue of $51.5 billion to $53.5 billion, on the lower end of the expected range, though it is still above the $50.6 billion reported a year ago.Analysts polled by Thomson Reuters expected guidance of fiscal second quarter revenue of $53.79 billion, up 6.4 percent year-over-year. Cook has attributed the company's expected return to growth iPhone 7, but also to growth in services revenue and a "very bullish" long-term future in China, where sales fell 12 percent in the first fiscal quarter. "The U.S. and China need each other," Cook told CNBC. "The world needs the U.S. and China to win."

Up to this point, Apple has seen sales crater in China. In the fourth quarter, sales tumbled 30 percent there, as local manufacturers like Huawei gained ground. Services, which include the App Store, iTunes, Apple Music, Apple Pay and iCloud, hit $7.17 billion, above the $6.91 billion projected by StreetAccount. With a growth rate of 18 percent year-over-year, services has become the fastest growing part of the business as iPhone sales have flattened out. "They need to make more money off [the iPhone] than just us buying a new phone every year…" Kevin Landis, chief investment officer of Firsthand Capital Management and Apple shareholder, told CNBC's "Closing Bell." "Services will hold the key there."

The number of users of Apple Pay have tripled over the past year, Cook said on the conference call, with transaction volume up 500 percent, year over year. The average adult smartphone user will spend an average of 41 minutes each day listening to digital audio via an app in 2017, eMarketer estimates. To that end, Apple is reportedly considering adding more original TV shows and films to its offerings, although that project has been confirmed independently by the company. The company has also released new wireless earbuds, AirPods, that are a "magical" experience, Cook said. Despite a new U.S. president that has promised to lower corporate taxes, Apple is projecting a tax rate of 26 percent in the second quarter, the same prediction it had for the first quarter.

In a conversation with CNBC, Tim Cook also addressed some of the trade rhetoric being put forth by President Donald Trump, including the prospect that President Donald Trump could declare a holiday and allow the company to bring back some of its foreign cash, and rising trade tariffs.

"Repatriation is front and center, and that is good for the country and good for Apple," Cook told CNBC. "The border tax would hit the middle class consumer." Shares of Apple have risen more than 6 percent over the past 3 months, amid the holiday shopping season, and following the release of the iPhone 7, new MacBook Pro, and AirPods.