Kotaro Matsushima crossed with the final action of the match to earn Japan a bonus point as they climbed to the top of Pool A with a battling 38-19 win against Samoa on Saturday.
The World Cup hosts claimed a shock victory over Pool A favourites Ireland last time out, but Samoa put up a good fight in Toyota City and looked like denying the Brave Blossoms the maximum haul until Matsushima touched down with the clock having passed 80 minutes.
Timothy Lafaele, Kazuki Himeno and Kenki Fukuoka also scored for Japan, while Henry Taefu accounted for all of Samoa's points.
The result sends Japan three points clear of Joe Schmidt's men at the summit and ends their opponents' slim hopes of a place in the last eight.
The boot of Yu Tamura fired Japan into a 6-0 lead before Taefu got Samoa on the board from the tee after 10 minutes.
Taefu and Tamura exchanged a further kick apiece before TJ Ioane was sin-binned for a late tackle, reducing Samoa to 14 men for 10 minutes - a fifth yellow card of the tournament for Steve Jackson's side.
Japan capitalised on their numerical advantage as Lafaele touched down following a fantastic run from Matsushima, Tamura adding the extras.
Taefu's third three-pointer saw Samoa go in 16-9 down at the break and he split the posts again early in the second to further reduce the deficit, before Tamura atoned for his first miss of the match by reestablishing Japan's seven-point lead.
Jamie Joseph's men finally gave themselves breathing space with Himeno's try from a driving maul, but Taefu added a converted try to his personal points haul six minutes from time to give his side hope of clinching at least a losing bonus point.
However, Japan pulled clear in the closing minutes, as Fukuoka and Matsushima went over in opposite corners to earn Japan an important bonus point of their own.
Japan v Samoa - Match Stats
Japan: (16) 38
Try: Lafaele (28'), Himeno (54'), Fukuoka (76'), Matsushima (81'+4)
Conversion: Tamura (30', 56', 81'+6)
Penalty: Tamura (3', 8', 24', 51')
Samoa: (9) 19
Try: Taefu (73')
Conversion: Taefu (74')
Penalty: Taefu (10', 16', 34', 45')
Man of the match: Lomano Lemeki (Japan)