* Mood lifted by strong performance in Shanghai shares
* Market awaits U.S. jobs data to set tone
* Commodity stocks hurt by falls in crude and gold prices
* Medium-term resistance seen above 10,600 on Nikkei
By Antoni Slodkowski and Ayai Tomisawa
TOKYO, Jan 7 (Reuters) - Japan's Nikkei average clung to gains on Friday after hitting an eight-month high the day before, as investors stayed cautious ahead of key U.S. jobs data, while a drop in commodity prices was offset by a strong performance in Chinese equities.
Sentiment in Tokyo, where the Nikkei shed 0.2 percent by midday, was brightened by gains on the Shanghai market <
>, as heavy lending by banks at the start of the year has flooded the Chinese stock market with cash while investors look forward to better corporate earnings for 2010 than previously expected.But gains were limited as the mood was soured by the previous day's drop in Wall Street stocks hit by soft U.S. retail sales and a stronger dollar against a basket of currencies, which made investors edgy before December's U.S. employment report due later on Friday.
"The mood on the Nikkei turned mildly positive in the afternoon lifted by the Shanghai market, which started on a very strong note," said Takashi Ohba, a senior strategist at Okasan Securities.
Shanghai's key stock index <
> gained 1.4 percent on Friday.But Ohba said rises will be limited as investors are cautious ahead of Friday's U.S. payroll figures, adding that the index may be nearly unchanged before the three-day weekend. Monday is a public holiday in Japan.
By early afternoon, the benchmark Nikkei <
> was almost flat, up just 5.68 points or 0.05 percent at 10,535.90.The broader Topix index <
> gained 0.2 percent to 926.29.Foreign investors were net buyers of Japanese stocks in the week to Jan. 1 for the ninth straight week, with net purchases totaling 23.5 billion yen ($282 million), the Finance Ministry said on Friday.
Analysts say such buying may continue through the January-March quarter as expectations for decent results from U.S. and Japanese firms will likely provide momentum for further gains.
"Nothing has changed market expectations that stocks will rise further,"said Masatoshi Sato, a senior strategist at Mizuho Investors Securities
Market analysts eye long-term resistance, which could be tested if the U.S. jobs data is better than expected, at 10,638, an intraday level hit on May 13 when the fiscal crisis in Greece rocked markets across the world.
Investors expect non-farm U.S. payrolls for December to show an overall gain of 175,000, with the unemployment rate falling to 9.7 percent from 9.8 percent.
Inpex Corp <1605.T>, Japan's biggest oil and gas developer, fell 1.4 percent after oil was trading near a 2-