It took eight quarters, but Apple has recovered its spot at the top of the worldwide smartphone market from Android device maker Samsung, according to the latest numbers from research firm Gartner.

Apple last month announced all-time record quarterly revenues of $78.4 billion on the back of 78.3 million iPhone sales for the three-month period ending in December. Handset sales were particularly strong and broke a record of 74.8 million units set in the year ago quarter.

Gartner puts iPhone end user sales at 77 million units a performance good enough to place Apple at the top of all vendors for the important fourth quarter. Overall, iPhone captured 17.9 percent of the global market, up 2.2 percent from the same time last year.

Samsung followed close behind with 76.8 million units sold and 17.8 percent of the market, down from a 20.7 percent share a year ago. Driving the second consecutive dip in quarterly sales was Samsung's Galaxy Note 7 battery fire fiasco, which resulted in a product recall and, ultimately, complete stoppage of sales.

"The withdrawal of the Galaxy Note 7 left a gap in its large-screen phone range," said Anshul Gupta, research director at Gartner.

Apple was not alone in capitalizing on Samsung's mistake, as Chinese smartphone vendors grew their respective slice of the global pie with low- and mid-tier hardware offerings. Huawei, Oppo and BBK Communication Equipment came in third, fourth and fifth place, respectively, and together captured 21.3 percent of the market.

Some 432 million smartphones were sold to end users in the fourth quarter of 2016, up 7 percent from 2015, Gartner said. For the year, smartphone sales totaled nearly 1.5 billion units, a year-over-year increase of 5 percent.

Gartner's analysis of operating system marketshare shows both Android and iOS making gains from the year prior. Google's OS was running on 81.7 percent of smartphones sold during the fourth quarter, up from 80.7 percent in 2015. Since iPhone is the only handset to run iOS, Apple's mobile OS accounted for 17.9 percent of the market during the same period.

Microsoft's Windows took a 0.3 percent share, while BlackBerry fell to "0.0 percent" with 208 thousand units sold. Once a bastion of enterprise smartphone revenue, BlackBerry has been largely decimated by Android and iOS.

In September, BlackBerry CEO John Chen announced the company was officially exiting the hardware business as it concentrates on software and services. Most recently, the Canadian firm opened a research center in Ottawa — technically an extension of its QNX subsidiary — to develop self-driving vehicle software.