Microsoft fared better than analysts anticipated in its latest financial quarter, boosted by an unexpected rise in sales of its Windows operating system for PCs.

But profits dipped due to unexpected losses in its Entertainment & Devices division, which houses the Xbox 360 games console and also its Windows Phone mobile software groups.

Revenues hit a record high of $17.4bn (£10.8bn), up 6% on a year before, but profits fell to $5.1bn (60c a share) from $5.2bn the year before – principally due to a surprising loss of $229m by the E&D division, down from a profit of $210m a year ago.

Analyst consensus had expected profits of 58c a share, or $4.93bn, on revenues of $17.2bn.

The stock is up 20% so far this year, outpacing the tech-heavy Nasdaq's 16% gain, and a 10% rise in the Standard & Poor's 500. Microsoft shares added 90c, or nearly 3%, to $31.91 in Thursday's extended trading.

But it is still below the heady levels of 10 years ago, as investors worry about the company's ability to match Apple and Google in online and mobile technology. Apple's market value is now comfortably twice that of Microsoft, and revenues from its iPhones last quarter exceeded Microsoft's overall revenue.

The Bing search engine, which also powers Yahoo's search, continues to be a big lossmaker for the company. Revenues in the Online Services division dropped off by sequential quarter from $784m to $707m, though up 6% in line with overall revenues from the previous year.

Profits remain elusive: the division lost $479m, compared to $458m the quarter before – suggesting that hopes of profitability are some way off yet. But compared to the year-ago quarter, losses reduced from $776m.

The engines of Microsoft's profit and revenue remain its Windows and Office software, which between them make up 105% of the company's profits – which are then pared back by losses in other divisions – remains strong.

Windows revenues in particular rose by nearly 4% to $4.6bn, at a time when sales of Windows PCs have been comparatively sluggish, growing by only about 1.9% in the quarter, according to analysts Gartner.

"The Windows beat was a positive surprise, looking at about 4% growth, versus expectations for about a 4% decline," said Josh Olson, an analyst at Edward Jones. Microsoft said it had been due to businesses buying licences for Windows 7, its current version of the operating system.

Profits from Office, which relies on upgrades especially from corporate customers, remained strong too, jumping 14%.

One of the quarter's bright spots came in Microsoft's Windows division, which has faltered in the past year as more people bought Apple's iPad and other tablet computers instead of desktop and notebook computers.

Analysts also have assumed that many businesses and consumers thinking about buying a PC would hold off until Windows 8 hits the market in the autumn.

"Next year at this time we should be talking about Windows 8 mobile and how it's contributing or not to the company," said Kim Forrest, analyst at Fort Pitt Capital Group. "But we really need Windows 8 to come out on all devices, to see if it's going to have that synergy or not."

The company gave no figures for sales of its Windows Phone mobile software, where Microsoft is partnering strongly with Nokia. Microsoft provided $250m of marketing funds to Nokia during the quarter.