Lennar Corp , the third-largest U.S. homebuilder, swung to a quarterly profit, mainly helped by higher margins.

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 homebuyers as a percentage of revenues from home sales, the company said.

December-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.

Shares of the company were up 2 percent in premarket trade. They closed at $19.75 on Monday on the New York Stock Exchange.

(Reporting by Megha Mandavia; Editing by Unnikrishnan Nair)