iPhone 6
A new leak sheds light on the Apple iPhone 6s, 6s Plus’ camera details. George Frey/Getty Images

While smartphone growth has slowed globally, the iPhone continues to buck the trend. The Apple smartphone gained market share in the second quarter of 2015, a portion of which it chewed away from Android, according to the latest data from Gartner.

During that period, Apple saw its market share grow to 14.6 percent, up from 12.2 percent during the same quarter in the previous year. Gartner largely attributes this to China, where iPhone sales grew 68 percent to 11.9 million units. That’s despite Chinese smartphone market numbers falling for the first time year-over-year by 4 percent.

"China has reached saturation -- its phone market is essentially driven by replacement, with fewer first-time buyers,” said Anshul Gupta, research director at Gartner, in a statement. “Beyond the lower-end phone segment, the appeal of premium smartphones will be key for vendors to attract upgrades and to maintain or grow their market share in China.”

But premium smartphones haven't exactly worked out well for Samsung, which reported poorer than expected smartphone sales in its second-quarter earnings. As a result, Samsung suffered the brunt of declining sales, as shipments fell by 72.1 million units, down 5 percent from the same period last year. Its market share also fell to 21.9 percent, down 4.3 percent from the same quarter in 2014.

But not everything was negative for Android manufacturers. Huawei saw shipments grow to 25.8 million units and market share grow to 7.8 percent, up 1.7 percent from the previous year. Xiaomi growth was smaller, with 4.9 percent market share, up 0.6 percent from the previous year.

The global smartphone market topped out at 330 million units, up 13.5 percent from the same quarter last year -- the slowest growth recorded in the period by Gartner since 2013.

Despite Apple’s market share gains, investors weren’t necessarily thrilled when the company reported its fiscal 2015 third-quarter earnings in July, which saw record revenue growth, but lower iPhone sales than Wall Street was anticipating.