Apple has bested Samsung as the number one global smartphone maker, but only by a razor-thin margin.
A new Gartner report this week showed that Apple (AAPL) now has 17.9% of the total smartphone market compared with Samsung’s 17.8% market share. In the fourth quarter, Apple sold 77 million iPhones while Samsung sold 76.8 million of its lineup of smartphones, the report said.
It’s a bit of a milestone for Apple, which has been second to Samsung in terms of smartphones for eight consecutive quarters.
“The last time Apple was in the leading position was in the fourth quarter of 2014, when its sales were driven by its first ever large-screen iPhone 6 and 6 Plus,” said Gartner research director Anshul Gupta in a statement.
Get Data Sheet, Fortune’s technology newsletter.
Gupta continued that Apple benefited from strong sales of its iPhone 7 and iPhone 7 Plus models as well as a “weakened demand” for Samsung phones across several regions like North America and Western Europe.
Sales of Samsung phones started to decline in the third quarter of 2016 and only amplified when Samsung stopped selling its Galaxy Note 7 phone in the fourth quarter, Gupta said.
Samsung had to take its Galaxy Note 7 smartphone off the market because of the potential that some batteries in the devices could explode. The smartphone debacle meant that Samsung was unable to sell its high-profile Galaxy Note 7 during the holiday season, which significantly hurt the tech giant, according to a January survey by Counterpoint Research.
Why Samsung Is Still In Big Trouble:
Apple wasn’t the only company to have benefited from the Samsung recall.
Chinese smartphone makers Huawei, Oppo, BBK, and Gionee all sold more phones in the fourth quarter than in the prior quarter, Gartner said. These companies generally sell cheaper and less feature-packed phones that compete with Samsung’s lower-end phones.
Huawei, in particular, poses a big threat to Samsung. The Chinese tech giant is currently the world’s third biggest smartphone maker in the world with a 9.5% market share, and its newest high-end phone, the Mate 9, lured some customers from Samsung.
“Huawei introduced Mate 9 during the quarter — within a month of Samsung discontinuing the Galaxy Note 7 — which was good timing to position it as an alternative,” Gupta said.