The PC industry sold more computers in 2014 than the year before, ending more than two years of declining sales, according to new research from Gartner. Lenovo took the top spot worldwide, selling more PCs last year than rivals HP and Dell, while HP shipped the most PCs in the U.S.

The total number of PCs sold in the last three months of 2014 peaked around 83.7 million units, a 1 percent increase over the same period a year ago. The trend shows the first consistent increase in PC sales after years of decline, as PCs were being displaced by tablets and smartphones over the past couple years.

The trend “peaked in 2013 and the first half of 2014. Now that tablets have mostly penetrated some key markets, consumer spending is slowly shifting back to PCs," said Mikako Kitagawa, a principal analyst at Gartner, in a statement.

Lenovo led sales for the year with nearly a fifth of the worldwide PC market, growing throughout Europe and the U.S. for shipments totaling 16.3 million units in the fourth quarter. HP was nearly able to close the gap, with a difference of less than 2 percent worldwide, or 15.8 million shipments, and stronger growth throughout Asia and the U.S.

HP sold three out of every 10 computers last year in the U.S., with 5.3 million shipments. Dell shipped 4.1 million PCs in 2014, while Apple’s PC sales rose to 2.1 million. Preliminary data showed that Americans were behind the majority of PC sales growth, along with parts of Europe, while customers in emerging markets still strongly preferred tablets and smartphones. Lower-cost notebooks led much of the growth, but struggled to find a foothold in emerging markets. Thin and light models, and two-in-ones, also surged in popularity.

“These results supports our assumption that consumer spending is returning to the PC as tablet penetration has reached the majority of the market,” Kitagawa said.