By Marcy Nicholson and Jan Harvey

NEW YORK/LONDON (Reuters) - Gold edged lower on Friday as some buyers cashed in recent gains, but the metal had its biggest weekly rise in two months as the dollar retreated and sliding oil prices hurt risk appetite.

Gold was up 2.5 percent this week after Tuesday's big rally. Falling stock markets have prompted some investors to buy the metal as an alternative asset, while a drop in the greenback made dollar-priced bullion cheaper for holders of other currencies.

"When the equity markets dropped quite sharply, precious metals soared, so there is definitely still the link between equities and gold in particular (due to) risk appetite among market players," Commerzbank analyst Daniel Briesemann said.

"Some of the equity markets had a decent run this year. We don't expect this to be continued to the same extent next year, so this might give some tailwind to gold prices."

Spot gold was down 0.5 percent at $1,221.66 an ounce by 3:38 p.m. EST (2038 GMT), while U.S. gold futures for February delivery settled down 0.3 percent at $1,222.50, but were up 2.7 percent for the week.

The spot market briefly fell as much as 1 percent to $1,215.60 after a survey showed U.S. consumer sentiment rose in December to a new eight-year high.

"What we're looking at here is better retail sales," said Eli Tesfaye, senior market strategist for RJO Futures in Chicago.

"These better numbers basically are going to bolster the case for the Federal Reserve to be more hawkish going forward.

That's never good news for gold."

The dollar index was down 0.4 percent, and European stocks slid more than 2 percent, with further declines in the price of oil hitting energy shares and political concerns over Greece also curbing risk appetite. [FRX/] [.EU] [O/R]

European shares posted their biggest weekly loss since mid-2011, while U.S. stocks also fell, putting the benchmark S&P 500 on track for its first weekly decline in eight. [.N]

Story continues

The improved sentiment toward gold showed in the hol dings of the world's top bullion-backed exchange-traded fund, SPDR Gold Trust, which rose 0.13 percent to 725.75 tonnes on Thursday, up nearly 5 tonnes this week. [GOL/ETF]

That marks the second straight week of inflows and the biggest weekly increase in its holdings since early July.

Among other precious metals, silver was down 0.5 percent at $17.00 an ounce, while spot platinum fell 1.1 percent to $1,224.50. Spot palladium was down 0.7 percent at $810.30.