Dell Inc posted profits that blew past Wall Street forecasts on improved profitability and the No. 2 PC maker raised its fiscal 2012 outlook for operating income, citing expectations for a robust back-to-school season and strong government spending.

Dell's gross margin was 22.9 percent in the quarter, above the average forecast of 20.35 percent, driven by the strength in its enterprise business that includes servers and storage.

The company expects its public sector business to get a boost from stronger spending among state and local governments and education customers as they close out their fiscal year.

Revenue in the fiscal first quarter ended April 29 rose to $15 billion from $14.87 billion a year ago, but fell short of the average analyst estimate of $15.4 billion according to Thomson Reuters I/B/E/S.

Shares of Round Rock, Texas-based Dell jumped 5 percent in extended trading after closing down 0.63 percent at $15.90. The shares were initially halted in after-hours trading.

The better-than-expected results are in sharp contrast to larger rival Hewlett-Packard Co's, which disappointed investors by cutting its profit outlook, sending its shares down over 7 percent.

Dell still generates most of its revenue from selling personal computers but is moving to diversify its revenue base, given the weakened demand in the consumer PC market.

Dell wants to become a larger player in the data center equipment market and gain a toehold in the fast-growing mobile space with tablets and smartphones, but faces stiff competition in those markets from the likes of International Business Machines Corp and HP.

Chief Financial Officer Brian Gladden said in an interview that the consumer PC business during the quarter fell short of company expectations, citing tablets as a factor.

Dell reported a net profit of $945 million, or 49 cents a share, up from $341 million, or 17 cents a share, a year ago.

Excluding items, Dell earned 55 cents a share, handily beating the average estimate of 44 cents a share according to Thomson Reuters I/B/E/S.

Dell raised its non-GAAP operating income growth expectations to 12 percent to 18 percent for the fiscal year, from its previous range of 6 percent to 12 percent. It also reaffirmed its 2012 revenue forecast of an increase of 5 percent to 9 percent.

(Reporting by Poornima Gupta; Editing by Richard Chang)