TOKYO, Sept 29 (Reuters) - Japan's Nikkei share average ended a volatile week with slight declines on Friday, swinging between gains and losses during the session to send the stock benchmark to its worst quarterly performance since mid-2022.

Selling of shipping stocks after they went ex-dividend and energy stocks tracking crude oil prices lower offset gains in chip stocks and follow-on from a Wall Street rally overnight.

Investors were also cautious amid uncertainty over a potential U.S. shutdown and the ongoing auto workers strike, along with key economic data next week, including the Bank of Japan's tankan survey and the U.S. monthly payrolls report.

"The risks to the U.S. economy are rising, and uncertainty is building," Nomura Securities strategist Maki Sawada said.

"It's very difficult to buy Japanese stock actively in such an environment."

The Nikkei edged down 0.05% to 31,857.62, bringing its loss for the week to 1.68%.

The broader Topix, with its lower concentration of tech shares, fell 0.92% for the day, and 2.23% for the week.

An index of Topix-listed value stocks tumbled 1.55%, while a growth stock index slipped 0.24%.

The Nikkei has lost more than 4% this quarter, its first quarterly decline since last September and its biggest since the previous June.

The benchmark index hit its highest since early 1990 at 3,3772.89 in mid June, and has slid about 5% since the most recent peak in the middle of this month.

Shippers, which pay the highest dividends among Japanese stocks, tumbled 4.38% to be the worst performer by far among the Tokyo Stock Exchange's 33 industry groups.

Oil and coal producers slumped 2.92%.

On the Nikkei, tech was the only bright spot, but the heavy weighting of some semiconductor stocks spared the index from deeper blushes.

Chip-testing equipment maker Advantest, which counts Nvidia among its customers, surged 2.98%, while chip-testing equipment giant Tokyo Electron advanced 2.58%.

(Reporting by Kevin Buckland; Editing by Rashmi Aich)