Astonishing game. Hand it to the Scots, their own second-half flurry nearly put pains to Japan's dream. As it is, the Japanese are through to their first quarter-final in history, in their own country.
With so much riding on the match, Scottish Rugby had threatened to sue World Rugby if the match had been postponed in the wake of Typhoon Hagibis wreaking havoc on the country.
A stadium inspection by World Rugby confirmed the game would go ahead as planned but the Scottish were unable to cope with the hosts' high intensity. Scotland started the match the stronger and made their intentions clear after just six minute when Finn Russell went over for the opening try, Greig Laidlaw adding the extras for a lead.
Kotaro Matsushima restored parity on 18 minutes for Japan, who forged ahead with additional first-half tries from Keita Inagaki and Kenki Fukuoka. A second Fukuoka try three minutes into the second half put Japan ahead and Scotland looked down and out.
Gregor Townsend's men did not throw in the towel though and their faint hopes of progression to the last eight were reignited when prop WP Nel found a way through the Japanese line from close range.
Click to playTap to play The video will start in 8Cancel Play now Japan produced a scintillating display of attacking rugby then withheld a spirited Scottish fightback to triumph on a memorable night in Yokohama and reach the Rugby World Cup quarter-finals for the first time on Sunday. Wing Kenki Fukuoka led the way with two tries, while Kotaro Matsushima and Keita Inagaki also scored as the hosts held off a fierce second-half assault from a team they had lost against in all seven of their previous meetings.
Zander Fagerson boosted Scottish hopes further when reducing arrears to , with Russell duly obliging with the conversion. Scotland needed another 15 points going into the final 15 minutes, with Japan already four points clear of their rivals in the Pool A table.
The win sees Japan clinch top spot in the pool and sets up a quarter-final match against South Africa next weekend. Wales won all their group matches at the Wold Cup for the first time since as they beat against Uruguay in Pool D.
In a much-changed line-up, Wales put together an error-strewn first half and led just at the break courtesy of prop Nicky Smith's try. They ran in a further four second half tries though to seal a bonus point victory to top the group.
Josh Adams and Tomos Williams went to ground either side of a penalty try and Gareth Davies completed the try-scoring as Leigh Halfpenny kicked four conversions.
Wales are set to take on France in the quarter-finals. In Pool C, the already eliminated Tonga won against the United States, who finished bottom of the group with four losses from four matches.
Pool winners England are due to take on Australia in the quarter-finals, with New Zealand and Ireland contesting the other last eight match. Canada's pool B match with Namibia was postponed after landslides and flooding in the Kamaishi area following Typhoon Hagibis.