Apple sold more iPhones than Wall Street had expected in the latest quarter, and the company forecast higher-than-expected revenue for the critical holiday-shopping season.

The world’s most valuable publicly traded company said on Tuesday it sold 45.51 million iPhones in the three months ended Sept. 24, beating the average analysts’ estimate of 44.8 million, according to research firm FactSet StreetAccount.

However, it was the third quarter in a row of falling iPhone sales, and the company’s revenue fell 9% to $46.85 billion, marking the third straight quarterly decline.

Revenue from Greater China, once seen as Apple’s next growth engine, fell 29.8% in the quarter, after dropping 33% in the preceding period. Revenue from Greater China doubled in the year-earlier quarter.

Apple’s shares aapl were down 2.1% at $115.75 in after-hours trading on Tuesday.

The shares hit a 12-month low of $89.47 in May but have been on an uptrend since then as investor confidence returned.

Apple forecast revenue of between $76 billion and $78 billion for the current quarter. Analysts, on average, had expected $75.08 billion, according to Thomson Reuters tri .

That meant annual revenue fell for the first time since 2001, highlighting the slowdown in the smartphone market as well as intensifying competition, particularly from Chinese rivals.

Analysts had expected revenue of $46.94 billion in the quarter, according to Thomson Reuters.

The company’s net income fell to $9.01 billion, or $1.67 per share in the quarter from $11.12 billion, or $1.96 per share, a year earlier. That beat the average estimate of $1.66 per share.

Apple’s fortunes are strongly tied to the success of the iPhone, which accounts for two-thirds of its revenue.

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

Get Data Sheet, Fortune’s technology newsletter.

Apple launched its iPhone 7 and iPhone 7 Plus models two weeks before the end of the quarter. Unusually, though, it did not release first-weekend sales figures, saying this data had become more of a reflection of supply than demand.

The fourth-quarter figures also include sales of the 6S and 6S Plus models as well as the smaller and cheaper iPhone SE.

Apple should have benefited from an extra week of sales in the latest quarter compared with last year.

The company is also expected to get a boost in the current quarter from problems at rival Samsung Electronics ssnlf , which halted production of its fire-prone Galaxy Note 7 smartphone earlier this month.