The Nikkei average squeezed out a 0.25 percent gain to finish at a five-month high on Tuesday as technology stocks such as Tokyo Electron Ltd followed their US counterparts higher.
But gains were limited by the afternoon release of weaker-than-expected Japanese machinery orders data. The data crimped the advance of machinery firms such as Fanuc Ltd and sent the Nikkei down nearly 150 points from the day's high.
"The numbers were worse than forecast. In fact, the results were near the lower limits of the estimates, so I think you can say the data was negative," said Hideyuki Suzuki, investment information manager at SBI Securities.
"Shares of companies that make automobile-manufacturing machines seem to have reacted," Suzuki said.
Investors largely ignored North Korea's announcement on Monday that it had conducted its first nuclear test. Japan's markets were closed for a public holiday on Monday.
The Nikkei finished up 41.19 points at 16,477.25, its highest close since May 12. It had risen as high as 16,620.15 before the release of the machinery orders data.
The TOPIX index ended up just 0.04 percent, or 0.62 point, at 1,634.83.
Chip-equipment naker Tokyo Electron was among the gainers, rising 1.7 percent to 9,470 yen. Nikon Corp, a maker of cameras and chips, rose 2.8 percent to 2,570 yen.
Those gains came after US tech stocks were boosted by an announcement that Internet giant Google Inc would buy online video service YouTube Inc Fanuc, a maker of industrial robots, ended the day up 0.1 percent at 9,380 yen. It had hit 9,530, a rise of 1.7 percent, before the release of the machinery orders data.
Komatsu Ltd, a maker of construction machinery, ended the day down 1.4 percent at 2,095 yen after earlier being in positive territory. The data showed core private-sector machinery orders, a key gauge of corporate capital spending, rose 6.7 percent in August from the previous month, below economists' forecasts for an 11.4 precent rise.
Shares of Shin-Etsu Chemical Co gained 1.7 percent to 7,920 yen after business daily Nihon Keizai reported on Saturday that the company is likely to beat its annual operating profit forecast by 12 percent due to strong demand for silicon wafers.
Shin-Etsu, the world's largest maker of silicon wafers, is on track to post a group operating profit of 241 billion yen ($2.02 billion) for the year to March, up 30 percent and a record for a 12th straight year, the paper said. The company declined to comment on the newspaper report.
Shares of Eisai Co Ltd rose 2.2 percent to 6,190 yen after Japan's fourth-largest drug maker said on Tuesday a US court had ruled that a substance patent on its ulcer drug Aciphex was valid, reducing chances of generic versions hitting the market soon.
Aciphex is its major product in the US market, accounting for about 45 percent of its overall US drug sales of 254.7 billion yen last business year. Trade edged up from the previous session, with 1.69 billion shares changing hands on the Tokyo exchange's first section. Decliners beat advancers by a ratio of more than three to one.