The surge in shipments came hot on the heels of the debut of the Galaxy S4. But the Galaxy S3 also picked up buyers thanks to price discounts ahead of the launch of its successor, IDC said.

Apple's smartphone market share last quarter fell to 13.1 percent from 16.6 percent for the prior year's quarter. Shipments rose to 31.2 million from 26 million, marking the company's second-lowest year-over-year iPhone growth rate in almost four years.

IDC pegged the slower growth on buyers holding off on purchases ahead of the iPhone 5S. IDC expects shipment growth to rise once Apple kicks off its rumored low-cost iPhone and expands into prepaid markets later this year.

Other smartphone makers, such as LG, Lenovo, and ZTE, saw growth in both market share and shipments.

IDC

"While Samsung and Apple accounted for significant share of the overall market, they were not the only vendors active in the high end of the market, and recent device introductions and upcoming launches signal more vendors targeting this space," Ramon Llamas, research manager with IDC's mobile phone team, said in a statement. "Comparisons will certainly be made to the flagship Galaxy and iPhone models, but clearly the competition refuses to be shut out altogether.

Overall, 237.9 million smartphones shipped last quarter, a 52 percent gain from the 156.2 million shipped during the same quarter in 2012.