Apple said it sold 31.2 million iPhones, a record for the June quarter, compared to 26 million last year.

But profit was down 22% from the same period a year earlier as its profit margins shrank to 36.98% from 42.8%.

However, average sale prices were lower at $581, compared with $608 a year ago.

Its revenue was also better than expected, with the company earning $35.3bn, although that was barely above the $35bn of a year ago.

Analysts said the data, especially on iPhone sales, may help allay some fears of a slowdown in Apple's growth rate.

"The iPhone number should provide some comfort to investors who were worried about smartphone demand," said Shannon Cross of Cross Research.

"That's one of the reasons the stock is up. Expectations were not strong for this quarter."

Outstripped

One of the brakes on the robust pace of growth that Apple has enjoyed in recent years has been the growing popularity of rivals such as Samsung - which has now become the world's biggest mobile phone maker - as well as the launch of low-cost smartphone by Chinese manufacturers.

According to its latest numbers, Apple's sales in China were also down by 4% in the April to June period.

Research firm IDC has estimated that 66% of the 385 million smartphones sold in China next year will cost less than $200 - significantly less than the cost of Apple's iPhone.

That has led some investors to fear that Apple may have to cut the price of its products in an attempt to attract customers.

At the same time, sales of its the iPad tablet computer, fell by 14% to 14.6 million units, compared with 17 million a year ago.

New products

Apple has spent most of the past 10 years as the darling of consumers and investors.

But a lack of new products - its last innovation was the iPad in 2010 - has seen faith in it wane recently, and strong competition from South Korea's Samsung in particular, has also eaten into its market share.

That has seen investors dump the stock. Its shares have dipped nearly 40% since hitting the peak in September last year.

This is the second quarter in a row that the technology giant's earnings have been below those of the previous year.

Analysts said that while the latest numbers were better than they had estimated, the company needed to come up with new products in order to keep growing at a robust pace.

"This was a 'blah' quarter and the story hasn't changed," said Adam Sarhan, chief executive of Sarhan Capital.

"Until it delivers a new, innovative product that really adds to both top and bottom-line, I would expect the stock to continue treading water."

For his part, Apple's boss. Tim Cook, said that the company was going to introduce new products soon.

"We are laser-focused and working hard on some amazing new products that we will introduce in the fall [autumn] and across 2014," he said.