TOKYO, July 21 (Reuters) - Japanese shares snapped a five-day losing streak on Wednesday, as investors bought stocks on dips over cautious earnings optimism ahead of a long weekend that will mark the start of the Tokyo 2020 Olympics.

The Nikkei share average closed 0.58% higher at 27,548.00, bouncing back from Tuesday's six-month low, though it failed to stay above a key chart level from its 200-day moving average, which sat at 27,712.

The broader Topix gained 0.82% to 1,904.41.

The market was supported by cheap valuations, with the Topix trading at 15.3 times its expected earnings - the cheapest level in more than a year.

Upbeat guidance earlier this month from companies such as Yaskawa Electric and Canon have raised hopes of more positive earnings revisions as the corporate results season in Japan gets into full swing from next week.

NOK Corp rallied 5.8% after the maker of oil seals bumped up its profit outlook.

"Japan has underperformed global peers year-to-date on the re-opening trade but we expect the gap to narrow as the domestic vaccine rollout gathers momentum," said Daisuke Nomoto, global head of Japanese equities at Columbia Threadneedle Investments in Boston.

"Japanese domestic economy will benefit from pent-up savings and employee compensation back to pre-Covid levels. Japan will also be a key beneficiary of global recovery and will experience a healthy earnings recovery supported by attractive valuations."

Bucking the trend, Tama Home plunged 10.2% after a media report the homebuilder was effectively banning its workers from getting COVID-19 vaccines, a claim the company denied last week.

The market will be closed for a national holiday until Monday as the Tokyo 2020 Olympic Games begin on Friday.

Concerns that the event could worsen Japan's COVID-19 outbreak and lead to political instability have been a major drag for the market in recent months.

The chief of the Tokyo 2020 organising committee on Tuesday did not rule out cancelling the Olympics if COVID-19 cases spiked, as more athletes tested positive for the virus and sponsors ditched plans to attend Friday's opening ceremony. (Reporting by Hideyuki Sano; additional reporting by Tomo Uetake; editing by Vinay Dwivedi and Subhranshu Sahu)