* Oil shares outperform on tensions in Middle East
* Investors unwind both long and short positions - analyst
By Ayai Tomisawa
TOKYO, June 24 (Reuters) - Japan's Nikkei edged higher in cautious early Monday trade as investors looked ahead to this week's G20 summit amid a backdrop of trade and geopolitical tensions.
The Nikkei share average was up 0.1% to 21,278.55 at the midday break, after traversing positive and negative territory.
Analysts said investors may keep to the sidelines as they focus on a possible meeting between Chinese and U.S. leaders on the sidelines of the G20 summit scheduled on June 27-29 in Osaka, Japan.
China's President Xi Jinping will attend the G20 summit, state-run Xinhua news agency said on Sunday, giving the first official confirmation of his attendance at a gathering where he is expected to meet U.S. President Donald Trump. Markets are hoping the two leaders could help restart stalled talks to resolve a months-long trade war.
"It's good that Trump and Xi are meeting but we still don't know what comes out of the meeting so investors are unwinding both of their long and short positions," said Yutaka Miura, a senior technical analyst at Mizuho Securities.
Tensions in the Middle East also kept investors on edge.
Trump said on Sunday he was not seeking war with Tehran after a senior Iranian military commander warned any conflict in the Gulf region could spread uncontrollably and threaten the lives of U.S. troops.
But U.S. Secretary of State Mike Pompeo also said "significant" sanctions on Iran would be announced on Monday aimed at further choking off resources that Tehran uses to fund its activities in the region.
That kept oil prices high, and pushed up Cosmo Energy Holdings 1.2% and Idemitsu Kosan 1.4%.
Exporters - especially those with large exposure to China - were down as the dollar remained pressured against the yen, with signs the Federal Reserve might move to cut rates soon denting the greenback.
Tokyo Electron shed 1.7% and TDK Corp dropped 1.3%.
The broader Topix was flat at 1,546.24. (Editing by Shri Navaratnam)