James Martin/CNET

Apple beat analyst expectations on Tuesday with better than expected earnings, buoyed by surprisingly strong iPhone sales.

Apple reported earnings of $6.9 billion, or $7.47 per share on $35.3 billion in sales. Wall Street was expecting Apple to post earnings of $7.32 per share on sales of $35 billion.

Apple said it sold 31.2 million iPhones, 14.6 million iPads, 3.8 million Macs, and 4.5 million iPods during the quarter. Wall Street was expecting Apple to have sold around 26 million iPhones, 17 million iPads, 4 million Macs, and around 6.8 million iPods, making the iPhone sales a standout.

"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," Apple CEO Tim Cook said in a statement. "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."

CNET

Looking ahead, the company said it expects fourth-quarter sales to be between $34 billion to $37 billion, with a margin between 36 percent and 37 percent. That's below the sales of $37.55 billion and in line with the 36.8 percent gross margin Wall Street analysts polled by Thomson First Call had expected ahead of Apple's numbers.

Shares popped in after-hours trading, jumping $14.95, or 3.57 percent, to $433.94.

The quarter continued a year-over-year profit decline, something Apple reported for the first time in a decade in its previous quarter. Before that, the last time Apple posted a decline was the very beginning of 2003 when the company was hit by both the economic downturn and a restructuring charge.

Apple chalked up the drop in profit to its gross margin, which was down 5.9 percent compared with the same quarter last year, though on the higher end of what the the company forecast back in April.

As usual, much of the expectation for Apple's performance rested on sales of the iPhone, which made up more than half of the company's overall revenues in the past two quarters. The product, along with the iPad, has served as a chief money maker and a catalyst to huge growth. Even so, the average sale price of iPhones was 4 percent less than it was a year ago, though Apple noted that the iPhone 5 was the most popular of iPhones sold during the quarter.

As for the weaker than estimated iPad sales, Cook called the 14.6 million iPads Apple sold "within the mid-point of the range" of the company's internal estimates. During a conference call with Wall Street analysts, he even took a shot at tablets from competitors.

"In terms of how other people are doing, I don't know," Cook said, pointing to data released on Tuesday from advertising analytics company Chitika that put the iPad's Web traffic share at 84 percent. "If there are lots of other tablets selling, I don't know what they're being used for," adding that Web browsing was a fundamental feature.

Other tidbits from the quarter's earnings:

57 percent of the quarter's revenue came from international sales. That's down from the 66 percent from Apple's previous quarter.

Apple's iTunes, software and services product group brought in $3.99 billion in revenue for the quarter. That's down 3 percent from the previous quarter, but up 25 percent from the same quarter a year ago.

Japan saw the biggest year over year jump in revenue, increasing 27 percent from the same time last year.

Mac unit sales declined 7 percent from the same time last year, though that only ended up being a percent decline in revenue.

Apple says the iPhone 5 remains the most popular, but it's "happy" with iPhone 4, 4S sales.

Analysts are looking ahead to the fall for Apple to release new products to bolster revenue. The company once again played coy with analysts when it came to being more specific during its conference call, with CFO Peter Oppenheimer saying only that it would be a "very busy fall," and that the company would "go into more detail in October."

Updated at 3:45 p.m. PT with additional details from Apple's conference call with analysts.