Microsoft Corp posted a 7 percent gain in net profit as demand for its Office software and improved results from its online arm more than compensated for a $1.1 billion charge to repair Xbox game consoles.

Microsoft also slightly raised its full-year earnings and revenue forecasts, citing demand for new software products like its Windows Server 2008.

The company said on Thursday net profit was $3.04 billion, or 31 cents per diluted share, in its fiscal fourth quarter, up from $2.83 billion, or 28 cents per diluted share, in the year-earlier quarter. Sales rose 13 percent to $13.4 billion.

The earnings met analysts' expectations for profit of 31 cents per share while sales were slightly better than the forecast of $13.27 billion, according to Reuters Estimates.

They beat by a little bit and raised by a little bit, said Jane Snorek, technology analyst at First American Funds. There were some expectations that with this PC boom we would see some big upside, but I guess not.

Microsoft said it estimated the personal computer market to have grown between 11 percent and 13 percent in the past three months.

Shares of Microsoft fell in extended trade to $31.08 after closing at $31.51 on Nasdaq.

The world's largest software maker had warned earlier this month that it would incur a charge of up to $1.15 billion in the quarter ended in June to fix an unacceptable number of Xbox 360 repairs and offer a new extended warranty to customers.

For the current quarter, Microsoft sees diluted earnings per share of between 38 cents and 40 cents, based on a revenue range of $12.4 billion to $12.6 billion. The average estimates of Wall Street analysts are for earnings per share of 38 cents on sales of $12.5 billion, according to Reuters Estimates.

The company lifted its fiscal 2008 earnings-per-share forecast range to $1.69 to $1.73 from its previous estimate of $1.68 to $1.72. It lifted its fiscal 2008 revenue range to between $56.8 billion and $57.8 billion from its prior forecast of $56.5 billion to $57.5 billion.

Microsoft said it continued to see strong adoption of its new Windows Vista operating system and Office 2007 business software, launched earlier this year.

The company said the Microsoft Business division, home to its Office business, posted a 19 percent rise in revenue to $4.63 billion, exceeding its sales expectations by $200 million on the back of Office 2007 demand.

Its online services group notched a third-straight quarter of revenue growth with an increase of 19 percent from a year earlier, boosted by a 33 percent rise in Web advertising.

The stock has risen 6 percent in the year to date, compared with a 10 percent gain in the S&P 500 during the period.

(Reporting by Daisuke Wakabayashi; Additional reporting by Gina Keating in Los Angeles)