Homebuilder ETFs rallied to fresh 52-week highs on Thursday after JP Morgan (NYSE: JPM) analysts were out with a bullish note on the sector, citing improving demand and price increases in the housing market.

SPDR Homebuilders ETF (NYSEArca: XHB) and iShares Dow Jones US Home Construction Index (NYSEArca: ITB) are among the best-performing sector funds in 2012 on optimism the housing market is finally on the mend. [ETFs to Capture a Turnaround in the Housing Market]

Although the ETFs are both classified as homebuilder funds, they have key differences that can affect performance. [Why a Homebuilder ETF is Outperforming Its Rival]

The housing market is set to improve over at least the next 18 months as demand increases and low supply pushes up home prices, JP Morgan said, upgrading stocks of three homebuilders, according to a Reuters report Thursday.

The analysts boosted their ratings on shares of PulteGroup (NYSE: PHM), KB Home (NYSE: KBH) and Beazer Homes (NYSE: BZH).

“While household formation, the core demand driver of housing starts, has begun to improve in 2012, greater gains still lie ahead,” JP Morgan analyst Michael Rehaut said, according to the Reuters story. “An incremental tightening of supply in 2012 should act as a solid protection against downside risk in the housing market, particularly in terms of home prices, in the event that demand slows or the macroeconomy falters near term, he added.”

ITB and XHB are up 43.7% and 30.6% year to date, respectively, according to investment researcher Morningstar.

U.S. home prices jumped 4.8% last quarter, the highest rate in eight years, mortgage giant Freddie Mac said Wednesday, Investor’s Business Daily reports.

iShares Dow Jones US Home Construction Index