Stocks mostly inched higher on Friday as rising energy shares offset early weakness, though the S&P 500 remained on track to break a five-week streak of gains.

Equities fell early after data showed a drop in single-family home sales, but a rebound in energy and material shares from their slump in the previous session, helped Wall Street overcome those losses. A rise in crude oil prices gave upside support to the energy sector.

The benchmark S&P 500 is down 1.2 percent for the week, though it remains up 10.3 percent for the year and up more than 25 percent from its October closing low.

While the swiftness of those gains have some investors waiting for further declines, many analysts do not see this week as the start of a deeper pullback. Instead, some are looking for a boost next week from quarter-end window dressing, when fund managers drop poor-performing stocks and chase the better-performing ones.

Overall, people feel good about stocks, so people want to jump in and buy on dips like we saw yesterday, said Michael Matousek, senior trader at U.S. Global Investors Inc, which manages about $3 billion in San Antonio. They're afraid of missing the boat so they focus on things that have lagged.

An S&P index of energy shares <.GSPE> rose 1 percent while the S&P materials index <.GSPM> added 0.9 percent. Alcoa Inc rose 1.6 percent to $10.18, leading the Dow.

Another catalyst for Friday's rebound in basic resources stocks was news that the world's top copper producer, Chile's Codelco, had reported a surge in profits and an increase in production. In Thursday's decline, both the energy and materials sector indexes fell more than 1.5 percent.

Crude oil futures prices rose 1.8 percent on news that tightening Western sanctions had caused Iranian oil exports to fall significantly this month. Chevron Corp rose 1.1 percent to $106.54.

The Dow Jones industrial average <.DJI> was up 23.43 points, or 0.18 percent, at 13,069.57. The Standard & Poor's 500 Index <.SPX> was up 1.97 points, or 0.14 percent, at 1,394.75. The Nasdaq Composite Index <.IXIC> was down 6.16 points, or 0.20 percent, at 3,057.16.

The S&P 500 was on track for its fourth straight decline, the longest losing streak in four months.

Home sales fell 1.6 percent in February, Commerce Department data showed, although a climb in prices kept optimism intact that the industry may have hit its bottom.

We're continuing to get mixed messages out of the housing market, said Rob Morgan, chief investment strategist at Fulcrum Securities in Philadelphia. Even though these numbers are in line, they're well short of what a healthy market would be.

KB Home tumbled 4.8 percent to $10.70 after the fifth-largest U.S. homebuilder posted a wider first-quarter loss and said orders for new homes declined.

Fellow homebuilder Beazer Homes lost 2.5 percent to $3.45. The PHLX housing sector index <.HGX> dipped 0.8 percent.

Zynga Inc fell 4.4 percent to $13.15 after the online games maker said shareholders will sell about 43 million shares in a secondary offering.

Job search website Monster Worldwide Inc is open to selling all or part of itself and expects to have data ready for potential buyers soon, its chief executive said in an interview. Monster's stock jumped 8.2 percent to $10.27.

Nike Inc posted higher quarterly profit late Thursday as the sportswear retailer headed into the spring season with strong demand. But Nike's stock, which had climbed earlier to a session high at $111.50, reversed gears and fell 3.1 percent to $107.55 at midday.

Darden Restaurants Inc lost 2.1 percent to $50.76 after it posted higher third-quarter profit, boosted by increased sales at its Olive Garden chain.

(Editing by Jan Paschal)