Shares of Apple (AAPL - Get Report) were advancing 5.2% to $157.97 in after-hours trading on Tuesday after the tech giant posted better-than-expected third-quarter results and upbeat guidance for the fourth quarter. The price represents a new all-time high for the stock. 

For more on Apple's results click on over to TheStreet's Apple earnings live blog.

Adjusted earnings were $1.67 per share, surpassing expectations for $1.57 per share. Revenue grew 7% year-over-year to $45.4 billion, which beat analysts' projected $44.9 billion.

Sales fell 14% from the prior period, however, as the company sold fewer units of its flagship smartphone. Apple sold 41.02 million iPhones in the third period, which was higher than Wall Street's estimated 40.04 million, but significantly lower than the 50.7 million units it sold during the second quarter.

Apple's third quarter tends to be seasonally weak period for the company, as consumers await the release of new products in the fourth quarter. CEO Tim CookCook has also cited increased media reports and leaks about the iPhone 8 as drivers behind the slump in sales.

"With revenue up 7 percent year-over-year, we're happy to report our third consecutive quarter of accelerating growth and an all-time quarterly record for Services revenue," said Cook in a statement. "...We're very excited about the advances in iOS, macOS, watchOS and tvOS coming this fall."

Apple said it expects to report sales between $49 billion and $52 billion for the fourth quarter, which is on the higher end compared to Wall Street's expectations for $49.2 billion in revenue. This most likely indicates that the company will have its 10th anniversary iPhone model ready in time for its traditional September event. Leading up to the earnings report, analysts were waiting with bated breath to see what the company would forecast, as expectations ran high that production might be delayed several weeks -- possibly until Apple's December quarter -- as a result of supply chain constraints.

The company also continues to face pressures in China. Once again, China was the only region to report a year-over-year sales decline, as Apple faces barriers to entry in that market, largely from local smartphone vendors. Cook has said previously that he continues to remain optimistic about Apple's room for opportunity there. 

Apple's Services business continues to be a bright spot in the company's earnings. Services revenue climbed 22% year-over-year to $7.2 billion, which was higher than analysts' projected $7.07 billion. The company has tried to turn investors' focus toward its fast-growing Services business as a means for Apple to diversify its revenue away from being solely hardware-driven and toward subscription-based sales. Cook has reiterated several times that he hopes to double Apple's Services business by 2020 -- it's already the company's second-largest business, second to iPhones.

iPad sales also remained stable in the quarter, with revenue up 2% year-over-year to $4.97 billion, beating consensus estimates of $3.95 billion. The company likely saw a boost from the release of the new 10.5-inch and 12.9-inch iPad Pro models, which were released in June.  

(Apple is a core holding of Jim Cramer's charitable trust Action Alerts PLUS. See all of his holding with a free trial here. )

Updated from 4:33 p.m. with additional information.

More of What's Trending on TheStreet: