* Mothers, Jasdaq both outperform broader market
* Foreigners post 790.9 bln yen of net selling in Japan cash stocks in 5 weeks
* Nikkei Inc to add Recruit, Japan Post, boosting their shares
* CyberAgent dives after disappointment it won't be part of Nikkei
TOKYO, Sept 6 (Reuters) - Japanese stocks ended nearly flat on Wednesday as retail investors' buying in small-to-mid sized stocks offset losses incurred when the market tumbled to four-month lows on heightened tensions in the Korean Peninsula.
The Nikkei ended 0.1 percent lower at 19,357.97, after getting as low as 19,254.67 - the lowest level since May 1.
The broader Topix ended 0.1 percent higher at 1,592.00 after trading in negative territory most of the day.
But retail investors, who sold small-to-mid cap stocks earlier this week, were seeing buying them back as they hunted for bargains, traders said.
The Mothers market of start-up shares outperformed, ending 0.4 percent higher, after hitting the lowest in more than four months.
The Nikkei Jasdaq index also gained 0.4 percent
A top North Korean diplomat warned that his country was ready to send "more gift packages" to the United States as world powers struggled to find an effective response to Pyongyang's latest nuclear weapons test.
"Japanese stocks' valuations are cheap and companies' fundamentals are not bad, but foreign investors see Japanese shares losing attraction because they are susceptible to East Asian risks," said Norihiro Fujito, a senior investment strategist at Mitsubishi UFJ Morgan Stanley Securities.
"There are expectations that the Bank Of Japan would buy exchange-traded funds when the market falls, but foreigners' selling is so big that it would offset the central bank's market-supporting operation."
The BOJ bought a total of 147.8 billion yen worth of ETFs over the past two days. Meanwhile, foreign investors have been net sellers of Japanese cash stocks for the past five weeks, offloading shares worth a total of 790.9 billion yen, Japan Exchange data showed.
Automakers were sold, with Toyota Motor Corp falling 0.9 percent and Nissan Motor Co dropping 0.6 percent.
Elsewhere, Japan Post Holdings and Recruit Holdings gained 1.9 percent and 7.8 percent, respectively, after Nikkei Inc said it will include the stocks in the Nikkei 225 as of Oct. 2.
On the other hand, the index provider said it will remove Hokuetsu Kishu Paper Co and Meidensha Corp from the index, sending their share prices down by 6.1 percent and 6.8 percent respectively.
CyberAgent dived 6.0 percent as investors had expected that the stock would be added to the index after some brokerages hinted in their reports that CyberAgent would be included.
Separately, the labour ministry said Japanese workers' wages fell in July from a year earlier due to a drop in summer bonus payments, casting doubts over the sustainability of a recent improvement in consumer spending.
The data had little impact on the market, traders said. (Reporting by Ayai Tomisawa; Editing by Eric Meijer)