Apple reported quarterly earnings that topped analysts' estimates and revenue that was in line with expectations on Tuesday, as it saw better-than-expected iPhone sales. But the quarterly results marked the third straight quarter where Apple posted a year-over-year revenue decline. The iPhone maker reported earnings per share of $1.67 per share, just above the $1.66 expected by a Thomson Reuters consensus estimate. Revenues came in at $46.9 billion, just shy of the $46.94 billion expected. That's still down from the comparable year-ago figures of $1.96 a share on sales of $51.5 billion.

Tim Cook Adam Jeffery | CNBC

Shares rose briefly about 2 percent in after-hours trading, but were last seen down more than 2 percent. With 45.5 million units, the company reported more iPhone sales than expected during the quarter. Apple was expected to report after the bell that it shipped 44.8 million iPhones. Still, iPhone shipments fell 5 percent, down from 48.04 million a year ago, according to analysts surveyed by StreetAccount. It comes after Apple reported revenues of $42.4 billion in the third quarter, down against the comparable year-ago figure of $49.61 billion in revenue. In the second quarter, Apple reported $50.56 billion in revenue, a roughly 13 percent decline against $58.01 billion in the comparable year-ago period. "We couldn't be more excited about the customer response to the iPhone 7 and the iPhone 7 Plus," CEO Tim Cook said. Apple's board also declared a cash dividend of 57 cents per share, payable on Nov. 10.

During its first fiscal quarter, the company said it expects revenue in the range of $76 billion to $78 billion, beating the $74.9 billion expected by analysts polled by StreetAccount.