No. 2 U.S. homebuilder D.R. Horton Inc reported a quarterly profit on Friday, surprising Wall Street and sending its shares up in premarket trading.

The company continued a trend of generally improving results across the sector. A tax credit has boosted home sales, helping the nation's housing market recover from a brutal downturn.

Horton recorded net income of $11.4 million, or 4 cents per share, reversing a year-earlier loss of $108.6 million, or 34 cents per share.

The results topped Wall Street's expectations, as analysts had anticipated a loss of 1 cent per share, according to Thomson Reuters I/B/E/S.

Revenue rose 15.7 percent to $896.8 million.

Market conditions in the homebuilding industry are still challenging, with rising foreclosures, significant existing home inventory levels, high unemployment, tight mortgage lending standards, the expiration of certain government support for the housing and mortgage markets and weak consumer confidence, said Chairman Donald Horton.

The company, which trails Pulte Group Inc in size, will keep its focus on building low-cost houses for first-time buyers, he said.

The results marked the Fort Worth, Texas-based company's second consecutive profitable quarter after almost three years of losses.

Horton shares rose 5.1 percent to $14.97 in trading before the market opened.

Results have started to improve across the sector, with Meritage Homes Corp and Ryland Group earlier in the week reporting improved bottom lines.

Pulte, which became the largest U.S. builder following its acquisition of Centex, is due to report results next week.

(Reporting by Scott Malone; Editing by Derek Caney and Lisa Von Ahn)