Lennar Corp , the third-largest U.S. homebuilder, swung to a quarterly profit, sending its shares up in premarket trading.

The Miami-based builder, which has operations in 14 states, said gross margins on home sales rose 80 basis points to 20 percent.

Gross margin percentage on home sales improved compared to last year, primarily due to reduced sales incentives offered to home buyers as a percentage of revenues from home sales, the company said.

December-to-February net income attributable to Lennar was $27.4 million, or 14 cents a share, compared with a net loss of $6.5 million, or 4 cents a share, a year ago.

Revenue fell 3 percent to $558 million.

Analysts on average were expecting a loss of 5 cents a share on revenue of $507.9 million, according to Thomson Reuters I/B/E/S.

Orders fell 12 percent to 2,267 homes. Orders are a leading indicator for homebuilders, who do not book revenue until they close on a home.

As the housing slump approaches its fifth anniversary, homebuilders continue to struggle with a heavy overhang of used homes and foreclosures that tempt buyers with more affordable prices.

Even at this late date in the downturn, sales and prices of new homes were still falling. Last week, the Commerce Department said new home sales fell 16.9 percent, putting the annual rate at the lowest since records began in 1963.

Lennar's shares were up 2.3 percent at $20.20 in premarket trading. The stock closed at $19.75 on Monday on the New York Stock Exchange, 9.4 percent off its 52-week high.

(Reporting by Helen Chernikoff and Megha Mandavia; editing by Maureen Bavdek)