NEW YORK ( TheStreet) -- Apple's ( AAPL - Get Report) third-quarter earnings managed to beat Wall Street expectations, as the company sold 31.2 million iPhones.

Cupertino, Calif.-based Apple earned $7.47 per share on $35.3 billion in revenue for its fiscal third-quarter. Analysts surveyed by Thomson Reuters were expecting $7.32 per share in earnings on $35.01 billion in sales.

During the quarter, Apple sold 31.2 million iPhones, up from 26 million in the year-ago quarter. It sold 14.6 million iPads during the quarter, compared to 17 million in the year-ago quarter, and sold 3.8 million Macs during the quarter, down from from 4 million in the year-ago quarter.

Gross margins during the quarter was 36.9%, down from 42.8% in the year-ago quarter.

"We are especially proud of our record June quarter iPhone sales of over 31 million and the strong growth in revenue from iTunes, Software and Services," said Tim Cook, Apple's CEO. "We are really excited about the upcoming releases of iOS 7 and OS X Mavericks, and we are laser-focused and working hard on some amazing new products that we will introduce in the fall and across 2014."

For the fourth-quarter, Apple expects revenue to be between $34 billion and $37 billion, with gross margins between 36% and 37%. It expects operating expenses to be between $3.9 billion and $3.95 billion.

Shares of Apple closed the regular session lower, off 1.7% to $418.99. The stock is higher in extended-hours trading, up 2.6% to $430.00.

-- Written by Chris Ciaccia in New York

>Contact by Email.