NEW YORK (Reuters) - World stocks advanced on Friday to end the week with a slight gain as a drop in the dollar helped boost slumping oil prices.

Slideshow ( 2 images )

The dollar fell against a basket of major currencies as preliminary data on U.S. factory and services activities in June fell short of analyst forecasts, stoking doubts about U.S. economic growth for the rest of 2017.

That drop in the greenback helped crude oil pull away from 10-month lows, although prices were still set for their worst first-half performance since 1997. On the week, both Brent and WTI crude have lost nearly 4 percent.

“Overall, the market is saying it would be nice to have a little more strength in the energy sector but the economy is doing OK without it,” said David Joy, chief market strategist at Ameriprise Financial in Boston.

“At the consumer level, cheap gasoline is not a bad thing and this is all translating into the lower inflation. Maybe that is part of the reason why the dollar is as soft as it is.”

U.S. crude CLcv1 settled up 0.6 percent at $43.01 per barrel and Brent LCOcv1 settled up 0.7 percent at $45.54 on the day.

The climb in crude helped lift energy stocks on Wall Street, with the group .SPNY up 0.8 percent.

The U.S. dollar briefly managed to recoup some of its declines after economic data showed new U.S. single-family home sales rose in May and the median sales price surged to an all-time high. The PHLX housing index .HGX advanced 0.6 percent.

The Dow Jones Industrial Average .DJI fell 2.53 points, or 0.01 percent, to 21,394.76, the S&P 500 .SPX gained 3.8 points, or 0.16 percent, to 2,438.3 and the Nasdaq Composite .IXIC added 28.57 points, or 0.46 percent, to 6,265.25.

The slide in energy prices in recent weeks has worsened the outlook for inflation, creating a problem for the world’s major central banks as they attempt to normalize interest rates after years of ultra-loose policy.

The pan-European FTSEurofirst 300 index .FTEU3 lost 0.28 percent and MSCI's gauge of stocks across the globe .MIWD00000PUS gained 0.19 percent to close out the week up 0.2 percent.

The dollar index .DXY fell 0.34 percent, with the euro EUR= up 0.41 percent to $1.1196.

The dollar had hit a one-month high on Tuesday following comments with a hawkish tone from Fed officials, including New York Fed President William Dudley and Boston Fed President Eric Rosengren. But it has been stuck in a tight range since and is up slightly on the week.

Earlier on Friday, St. Louis Fed President James Bullard said the central bank should wait on any further rate increases until inflation is reliably heading to the Fed’s 2-percent target. Cleveland Fed President Loretta Mester said failure to hike U.S. rates could mean missing inflation and employment goals that could cause a recession.

The lower dollar also helped boost gold prices, but the prospect of further interest rate rises in the United States limited gains.

Spot gold XAU= added 0.4 percent to $1,255.13 an ounce. U.S. gold futures GCcv1 gained 0.59 percent to $1,256.80 an ounce.