Apple reported quarterly earnings and revenue that topped analyst expectations on Tuesday, as its bet on the iPhone SE paid off. The technology giant reported earnings of $1.42 per share on revenues of $42.4 billion, above the $1.38 per share on sales of $42.09 billion expected by a Thomson Reuters consensus estimate. That's down against the comparable year-ago figure of $1.85 per share on $49.61 billion in revenue.

Apple CEO Tim Cook Getty Images

Apple shipped 40.4 million iPhones in the third fiscal quarter, above the 40.02 million expected by StreetAccount estimates.

"At its launch, we said the addition of the iPhone SE to the iPhone lineup placed us in a better position to meet the needs of customers who love a 4-inch phone, and to attract even more customers to our ecosystem," CEO Tim Cook said in a conference call with investors. "In both cases, that strategy is working." The company debuted the iPhone SE in March for $399 for the 16GB model, much lower than a traditional iPhone debut. It had mixed response on Wall Street, where some worried it wasn't as drastic of an upgrade as other models, and might erode sales of higher-end models. Cook said the phone is popular in both developed and emerging markets, and those switching from other carriers accounted for the highest percentage of quarterly iPhone sales Apple has ever measured. Analysts have expressed widespread concerns that consumers aren't upgrading their iPhones as often as they used to. But Tim Cook told CNBC he feels fantastic about how the iPhone did, and that it will be more important than ever looking forward. Indeed, Apple could be near the sale of its billionth iPhone, said Andy Hargreaves, Pacific Crest analyst.

In the fourth quarter, the company expects to earn $45.5 billion to $47.5 billion in revenues. StreetAccount consensus estimates had predicted $45.94 billion.

In what is traditionally a weak quarter, Apple was expected to report its second consecutive quarter of year-on-year revenue declines, after last quarter saw the first year-over-year quarterly sales drop since 2003.

Shares of the company have fallen more than 20 percent since this time last year, when Apple posted its smallest EPS beat in two years.

During the past quarter, I visited China and India, and I am very encouraged about the growth prospects in those countries. Tim Cook Apple CEO

Sales in China were also in focus, down 33 percent year over year to $8.8 billion. That's after currency pressures in Hong Kong weighed on last quarter's earnings. Competition in China's market has intensified, which some say may threaten iPhone market share there.

But China Mobile told Cook that there are more iPhones on their network than any other brand, and that their underlying business in China is stronger than results imply. Still, the economic conditions there are slowing, he said.

"During the past quarter, I visited China and India, " Cook said. "And I am very encouraged about the growth prospects in those countries. We remain very optimistic about the long-term opportunities in greater China." India, in particular, has "huge potential," Cook said, as Apple looks to open retail stores there.