The iPhone sales decline is real: For the second quarter in a row, Apple has sold fewer iPhones than a year ago. Apple sold a total of 40.4 million iPhones during its fiscal Q3 of 2016, which ended on June 30. During the same quarter last year, the company was still able to sell 47.5 million iPhones.

Apple announced these numbers as part of its Q3 earnings release Tuesday, which were in line with muted investor expectations.

During the most recent quarter, Apple generated revenue of $42.4 billion compared with $49.6 billion during the same quarter last year. Net profits came in at $7.8 billion, compared with $10.7 billion a year ago. This equals earnings per share of $1.42, compared with $1.85 for fiscal Q3 of 2015.

Analysts had expected earnings per share of $1.40 and revenue of $42.2 billion. The fact that Apple beat expectations on earnings gave its stock a 5 percent boost in after-hour trading.

These results follow a pretty bleak second quarter, and things don’t necessarily seem to get better for Apple: The company’s guidance for its fiscal fourth quarter, which will end on September 30, forecasts revenue to come in between $45.5 billion and $47.5 billion, compared with $51.5 billion during Q4 of 2015.

Popular on Variety

A continuing bright spot for Apple is its services business: The company generated close to $6 billion in revenue with Apple Music and other services during the most recent quarter, compared with around $5 billion a year ago. This means that services are now Apple’s second-biggest revenue driver, ahead of both Mac and iPad sales.

Apple’s China business on the other hand continues to be a sore spot. Revenue in greater China declined 33% year-over-year. Still, Apple CEO Tim Cook said during the company’s earnings call that he remains “very encouraged about growth prospects” in China as well as India. Apple generated close to $40 billion during the first three quarters of its current fiscal year in China, Cook said.

Cook also hinted at bigger plans for Apple TV: One shouldn’t confuse the current-generation Apple TV with Apple’s plans for the living room, he argued. “Think of that as sort of building the foundation for what we believe can be a broader business over time.”

Apple doesn’t break out sales of Apple TV, but lumps the device together with Apple Watch, iPod and other device sales. That category declined 16 percent, generating a total of $2.2 billion in revenue.