Gold prices rose on Friday and were on course for their best week in nearly five months, as the U.S. dollar extended its retreat in the wake of worrying U.S. economic data.

Spot gold rose 0.5% to $1,766.08 per ounce by 0824 GMT. It has gained about 2.1% so far this week, the most since early-March.

U.S. gold futures also rose 0.5% to $1,778.50.

Gold remains inversely correlated to the dollar and yields, rather than being a gold story in itself, OANDA senior analyst Jeffrey Halley said.

Despite an upbeat week for gold, it was still poised for a fourth consecutive monthly drop, its worst run of monthly losses since November 2020. The dollar has spent most of July hovering around 20-year highs, hammering demand for greenback-priced gold among other currency holders.

Also weighing on bullion prices were top central banks adopting an aggressive approach to interest rate hikes and monetary policy tightening in their attempt to combat inflation, along with a strong showing from U.S. Treasury yields earlier in July.

Higher rates lift bond yields, increasing the opportunity cost of holding non-yielding gold. "Although bullion saw a sell-off below $1,700 (earlier this month), it is significant that long-term support at $1,675/80 was tested and held.

Gold has been trying to form a bottom since," Halley said. The U.S. economy unexpectedly contracted in the second quarter, raising risks of an economic slowdown, which helped lift safe-haven gold's prices by more than 1% on Thursday.

Spot silver firmed 0.2% to $20.02 per ounce, but is set for a monthly loss. Platinum rose 0.9% to $896.15.

Palladium eased 0.2% to $2,072.87, but has gained about 7% this month, its best since February.

(Reporting by Bharat Govind Gautam in Bengaluru; Editing by Sherry Jacob-Phillips and Vinay Dwivedi)