NEW YORK -- A two-year slump in personal computer sales ended in the second quarter, helped by improving demand in developed markets like North America and Europe.

PC sales have fallen in recent years, hurt by surging demand for tablets and other mobile devices. Tough economic conditions around the world have also disrupted sales. But quarterly figures released Wednesday by the research firms Gartner and IDC show the global slump is easing.

During the April to June quarter, Gartner said PC shipments edged up 0.1 percent to 75.8 million units. IDC, which also tracks PC shipments, had slightly different figures. Both firms, however, said sales posted their best quarterly results since the second quarter of 2012, when demand for tablets and mobile devices began to surge. IDC said by its calculations PC shipments fell 1.7 percent to 74.4 million units. That number was much better than the 7.1 percent decline the firm expected.

Marlene Ortiz, left, and Miche Luna shop at a Best Buy for a $399.99 HP computer late in the evening on Thanksgiving Day, Thursday, Nov. 28, 2013, in
Marlene Ortiz, left, and Miche Luna shop at a Best Buy for a $399.99 HP computer late in the evening on Thanksgiving Day, Thursday, Nov. 28, 2013, in Dunwoody, Ga. (David Tulis/AP Photo)

Better sales in developed markets and interest in lower-priced PC models like the Chromebook, which uses Google's operating system and starts at $199, helped boost results. IDC vice president Loren Loverde said the better-than-expected results are partly due to a rebound from weaker demand last year, and potentially short-term replacement activity.

"We can look for some recovery in emerging regions going forward, but it may coincide with slower growth in mature regions, and we do not see the recent gains as a motive to raise the long-term outlook," he said in a statement.

Sales were strongest in Europe, the U.S. and Canada. Emerging markets continued to see declines, however, hurt by weak economies and competition from low-cost tablets.

In the U.S., shipments rose 6.9 percent, spurred by businesses replacing office PCs and consumers updating Windows XP systems. Microsoft retired the Windows XP operating system earlier this year.

"One encouraging factor was a good intake of lower-end systems, including Chromebooks, which coincides with the recent slowing in tablet growth and perhaps signals the beginning of some stabilization on the consumer side," said IDC Senior Research Analyst Jay Chou.

IDC analyst Rajani Singh added that strong back-to-school and holiday seasons could help the U.S. PC market stay in positive territory for the rest of the year.