Apple's profits in the June quarter plunged 27 percent while revenue fell 14.6 percent as the tech giant struggled with falling demand for the iPhone 6S and 6S Plus in key markets like China and the US. However, the company beat analysts' expectations helping buoy its stock price.

The California-based company managed to sell 40.3 million iPhones in the three months up to June – down 15% on a year ago. Despite the decline in sales, Apple beat the average analyst forecast of 40.02 million. The company's chief executive, Tim Cook, said the figures showed "stronger customer demand... than we anticipated".

The figures mark a second straight quarter of declining iPhone sales. It follows a 13-year period of growth.

Analysts say users are simply not as excited about the latest phone models. Accordingly, the company's overall revenue declined 15% to $42.4bn (£32.2bn, €38.6bn) for the three months to 30 June.

"We had a June quarter that was better than we had expected 90 days ago," Apple's Chief Financial Officer Luca Maestri was quoted as saying by Bloomberg. "The March quarter seems to have been the low point for the cycle."

The Apple logo is displayed on the exterior of the new flagship Apple Store in San Francisco, California Justin Sullivan/ Getty Images

"There are some macro conditions that exist in China, both in mainland China and in Hong Kong." Maestri added. "The economy has slowed down and the foreign exchange rate has weakened."

The third quarter slump was eased by demand for the new SE model, a cheaper model with a four-inch display. "We had a very successful launch of iPhone SE," said Maestri.

In the last quarter, Apple registered a 16.3% drop in iPhone sales – the first fall since the device was launched nine years ago. According to Reuters, iPhone sales make up about two-thirds of Apple's total sales.

The company said revenue for the fourth quarter will be between $45.5bn and $47.5bn, with gross margins of 37.5% to 38%.