Tokyo stocks recovered early losses and closed higher on Wednesday as investors bought on dips following two days of declines.
The Nikkei 225 index rose 0.26 percent, or 59.53 points, to 23,110.61, while the broader Topix index gained 0.18 percent, or 2.88 points, to 1,613.73.
Tokyo shares opened lower despite overnight gains on Wall Street, where the S&P 500 on Tuesday notched its first closing record since February.
But investors started buying on dips, helping the Nikkei index close in positive territory following declines earlier this week, they said.
"Sentiment is not so bad as the Nikkei index is staying above the 23,000 level," said Shinichi Yamamoto, a broker at Okasan Securities in Tokyo.
"But investors are slightly concerned about a strong yen," Yamamoto told AFP.
The dollar stood at 105.51 yen in Asian afternoon trade compared to 105.40 yen in New York and 105.57 yen in Tokyo Tuesday.
A weaker dollar and a higher yen usually weigh on the Tokyo market.
Investors largely shrugged off Japan's trade figures released earlier in the day.
Shortly before the market opened, the government said Japan's exports in July plunged 19.7 percent from a year ago, marking the 20th straight monthly fall, led by automobile and auto parts.
Meanwhile, imports fell 22.3 percent -- their 15th straight monthly decline -- largely due to the value of energy products such as oil, gas and coal.
Exports to the US and Europe saw double-digit falls, but China-bound exports rose 8.2 percent, their first rise in eight months, driven by non-ferrous metal, semiconductor making tools and automobiles.
Among major shares in Tokyo, market heavyweight SoftBank Group surged 3.27 percent to 6,397 yen, with Fast Retailing, operator of Uniqlo, up 0.49 percent at 61,250 yen.
Toyota rose 0.26 percent to 7,195 yen with Nissan up 0.95 percent at 420.8 yen.
Nintendo gained 1.04 percent to 53,380 yen, but Sony dropped 2.76 percent to 8,526 yen.