Global smartphone shipments rose 6.5 percent, while sales to consumers jumped 6 percent, the latest industry data showed.
The latest market data also showed the iPhone staging a recovery since March.
Aggressive discounts around China’s 618 shopping festival helped entice consumers in the world’s biggest mobile market, where Xiaomi and a resurgent Huawei Technologies have been making inroads this year, Bloomberg reported, citing the IDC report.
IDC said Apple shipped 45.2 million handsets in the quarter, a 1.5 percent improvement on the same period a year earlier.
The data by Counterpoint, which addresses end-user sales, showed a 1 percent decline, and both research groups found the iPhone giving up market share.
Xiaomi was the biggest riser, largely powered by entry-level handsets and emerging markets.
The iPhone has been under pressure in China from local players as well as a government ban on foreign devices at state-run workplaces.
Discounts and the promise of new artificial intelligence enhancements has helped steady sales for Apple and market leader Samsung Electronics, which is also promoting a new generation of phones with AI additions.
“Apple’s momentum in Q2 improved significantly from the negative growth they saw in the first quarter,” said IDC research director Nabila Popal.
“This is in part due to heavy discounts and promotions in many regions but also thanks to renewed customer confidence after WWDC when Apple finally announced its AI strategy,” Popal said.