Winger Kenki Fukuoka produced two pieces of individual brilliance as a high-paced Japan advanced to the Rugby World Cup quarter-finals for the first time with a 28-21 victory over Scotland at Yokohama.
The win ensured Japan finished top of Pool A and will face Pool B runners-up South Africa in Tokyo next Sunday, with Ireland facing Pool B winners New Zealand at the same ground on Saturday (11.15am Irish time, live on RTÉ television and radio).
Gregor Townsend's Scots needed an eight-point triumph to book a quarter-final slot and it looked promising when Finn Russell put them ahead early.
But the Brave Blossoms hit back with a series of ceaseless attacks as they repeatedly crashed through the Dark Blues to secure top spot in Pool A and a rematch with their 2015 victims South Africa.
Kenki Fukuoka grabbed a double either side of halftime as the tournament hosts were roared on by a sea of red and white jersey-wearing fans with a frenetic attacking game and ferocious defence.
Star winger Kotaro Matsushima scored his fifth of the tournament but it was prop Keita Inagaki who finished off a stunning move that will be hard to beat for try of the competition.
Scotland refused to go down without a fight and battled back from 28-7 down with half an hour left but second-half scores from forwards WP Nel and Zander Fagerson were not enough to prevent the Scots suffering their second pool exit in three tournaments.