Microsoft Corp said on Thursday fiscal second-quarter profit fell very slightly, as lower computer sales hurt its core Windows business.

The world's largest software company reported net profit of $6.624 billion, or 78 cents per share, compared with $6.634 billion, or 77 cents per share, in the year-ago quarter.

The per share figure rose as Microsoft had fewer shares outstanding in the most recent quarter. It beat Wall Street's average forecast of 76 cents.

Sales rose 5 percent to $20.9 billion, in line with analysts' forecasts, helped by its Office, server software and Xbox businesses.

Microsoft shares rose 2.2 percent after hours to $28.78. They closed at $28.12 on Nasdaq.

The results are pretty much in line with my expectations. We all expected the PC market to be weak and the Windows business was down because of that. But the server and tools business is growing well, said Sunit Gogia, an equity analyst at Morningstar.

(Additional reporting by Alistair Barr; Editing by Bernard Orr)