Nearly 1.5 billion smartphones were sold to end users in 2016, an increase of 5% from 2015, according to market research firm Gartner. And despite a sloppy second half of the year, Samsung held on to remain the top vendor worldwide for the year, shipping 306 million devices.

Apple trailed by almost 100 million units, with sales of 216 million smartphones for the year, Gartner data indicates.

2016 was definitely not a banner year for Samsung, with the Korean vendor more likely be remembered for its Galaxy Note 7 debacle rather than for its leading shipment total for the year. The company's troubles started in the third quarter and its shipments continued falling through the end of the year.

Gartner indicated that the fourth quarter of 2016 had Apple leapfrogging past Samsung to secure the top position among global smartphone vendors for the first time since 2014. Apples shipments were up 7.7% for the quarter, with sales driven by strong demand for the iPhone 7 and iPhone 7 Plus, noted Anshul Gupta, research director at Gartner. Apple also benefited from weakened demand for Samsung's smartphones in mature markets such as North America and Western Europe, and in some mature markets in Asia such as Australia and South Korea.

Samsung's shipments fell 8% in the fourth quarter of 2016 and its share dropped by 2.9 percentage points year on year, Gupta stated. It was the second consecutive quarter in which Samsung delivered falling quarterly smartphone sales. Gupta added that Samsung's decision to discontinue the Galaxy Note 7 slowed down sales for its smartphone portfolio in the fourth quarter. The withdrawal of the Galaxy Note 7 left a gap in its large-screen phone range, while growing competition in the midtier and entry-level smartphone segments from Huawei, Oppo, BBK and Gionee also made things difficult for Samsung, Gupta explained.

Overall smartphone shipments grew 7% worldwide to reach 432 million units in the fourth quarter of 2016, a 7% increase over the fourth quarter of 2015, according to Gartner.