Apple has overtaken Samsung to become the world's top smartphone brand worldwide for the first time in two years.

Apple sold 77.04 million smartphones during the fourth quarter of 2016, a key holiday shopping quarter, beating the 76.78 million sold by Samsung, according to data released on Monday by research firm Gartner.

Source: Reuters

Apple now controls 17.9 percent of the global smartphone market, while Samsung comes in just behind its rival with 17.8 percent, making it a close fight for the top position. With just 256,000 handsets as the difference between the two, the race is closer than ever.

Source: Gartner

Samsung slipped behind in 2016 because of the Galaxy Note 7 battery fiasco while Apple's success was driven mostly by strong sales of iPhone 7 Plus.

"This time it [Apple] achieved it thanks to strong sales of its flagship phones — the iPhone 7 and iPhone 7 Plus; it also benefited from the weakened demand for Samsung's smartphones in mature markets, such as North America and Western Europe, and in some mature markets in Asia-Pacific like Australia and South Korea'', said Anshul Gupta, research director at Gartner.

Besides this, Samsung is also facing growing competition in the mid-tier and entry-level smartphone segments from Huawei, Oppo, BBK and Gionee, which all saw their sales growing.

Huawei, in particular, is gradually catching up on Samsung and Apple, as it remained steady at the third position, selling 40.8 million units and holding an 8 percent share of the market.