Supercomputer maker Cray Inc. said Monday that a 40 percent surge in revenue helped shrink its first-quarter loss.

Losses dipped to $1.5 million, or 4 cents per share, from $11.6 million, or 34 cents per share, in the January-March period a year ago. Revenue jumped to $39.9 million from $28.4 million.

The results topped the average estimates of analysts, who had predicted a loss of 45 cents per share and revenue of $36.7 million, according to FactSet.

Cray shares rose 42 cents or nearly 7 percent, to close at $6.71 before the report, and jumped more than 8 percent after hours.

Gross profit margins nearly doubled to 43 percent, helped by a custom engineering contract whose costs were booked in a prior period. Operating costs were flat at $18.1 million.

Cray did lower the bottom end of its 2011 revenue outlook because of federal budgeting delays in the U.S. and abroad. It is forecasting a range of $300 million and $340 million for the year. Second-quarter revenues will come in between $65 million and $70 million, while fourth-quarter revenues will likely represent half of the year's total, the company said.

For the year, total gross margins are expected to be in the mid-30 percent range with core operating expenses expected to be about $100 million. Based on this outlook, Cray said it expects to be profitable for 2011.

Analysts are expecting full-year earnings of 37 cents per share and revenue of $328.5 million.