César Salza/CNET

The gap in global phone sales between Apple and Huawei is smaller than ever.

Apple, the world's No. 2 phone seller by volume, sold 41 million iPhones in the second quarter. Huawei, the No. 3 global phone brand thanks to its popularity in China and Europe, sold 38.5 million phones during the same period, Counterpoint Research said Tuesday.

Huawei's numbers are up 20 percent from the same quarter last year, while Apple's year-on-year growth was 2 percent. Of course, the Cupertino, California-based company has little to worry about. Though it sells fewer phones than Samsung and may eventually fall behind Huawei, it has always topped profit share. In 2016, Apple accounted for just under 80 percent of all smartphone profits.

"Apple is the most profitable smartphone brand on the planet with highest brand equity, however, it is in a conundrum," Counterpoint's Neil Shah told CNET. Apple is losing ground in China, while brands like Huawei and Oppo are becoming more popular. "Apple has been losing revenues in China since (the 2014) iPhone 6 (and) 6Plus launch, which was the peak for Apple in China," he said.

Oppo and Xiaomi, two other Chinese phone giants, also grew considerably. The former sold 30.5 million phones in the second quarter, a 33 percent rise, while the latter's 23.3 million was a 60 percent increase over the prior year.

Samsung is still king though, with 80.4 million in phone sales in the quarter. LG, its South Korean competitor, sold 13.3 million phones, 600,000 fewer than in the same quarter last year.

CNET Magazine: Check out a sampling of the stories you'll find in CNET's newsstand edition.

Star Wars at 40: Join us in celebrating the many ways the Force-filled sci-fi saga has impacted our lives.