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.
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.
Shares of Apple are down about 1 percent over the past year, but up nearly 20 percent in the past 3 months. As the main source of the company's revenue, iPhone sales are known to move the company's stock even more than earnings.
Apple's biggest stock pop after an earnings beat was from April 2012, on much stronger-than-expected iPhone sales, and Apple gained 8.9 percent the next day, according to Kensho data. Apple's biggest stock drop after an earnings and revenue beat was from January 2013 when iPhone sales missed expectations and the stock fell nearly 12.4 percent, according to Kensho.
It comes on the heels of the company's latest phone, iPhone 7, which investors hope will turn around sliding iPhone sales in the holiday season.
The new iPhone has been promoted aggressively by wireless carriers, amid a massive recall of rival high-end phone, the Samsung Galaxy Note 7, over safety concerns. Google, maker of rival operating system Android, has also released a new Pixel phone in time for the holidays.
Apple is holding a press event on Oct. 27, where industry blogs expect it will reveal new Macs.
"It's going to be interesting: The next 6 to 12 months are pivotal for the industry," said Dan Ives, senior vice president of finance and corporate development at Synchronoss Technologies, a mobile cloud services platform. "It speaks what type of pent up demand there is. Does Google become a player? Will Samsung get back on track? I think it's almost like a game of high stakes poker. You want to see where everyone's cards stand."
— Reporting by CNBC's Gina Francolla