Japan scored a converted try in the final five minutes of the game to beat Portugal 35-34 and win the World Rugby Under-20 Trophy in Brazil.
This year's World Cup hosts looked to be heading to defeat at 34-28 down but Kenichiro Kawase crossed to score with 76 minutes on the clock to bring his side within one.
Ryuto Fukuyama duly added the conversion to win the game and leave the Portuguese stunned at the Estádio Martins Pereira in São José dos Campos.
Winning the second-tier event means Japan have returned to the top-level Under-20 World Cup at the first time of asking after suffering relegation in 2018.
They made a lightning start to the final as they raced into a 14-0 lead with just 10 minutes played.
Takasmasa Maruo crossed for the first try off the back of a scrum before Halatoa Vailea raced down the left flank for a second, with both converted by Fukuyama.
Portugal were then handed a stroke of luck as Japan spilled the ball from the kick-off, allowing Rodrigo Mata to run in their first try.
Jerónimo Portela converted and Japan's Ryosuke Kawase was then shown a yellow card for a high tackle.
With the extra man, David Costa was driven over the line for a second Portugal try and Portela converted to level the match.
Raffaele Storti then made it even better for the Europeans as he cut through Japan's defence to cross, with Portela's extras putting his side 21-14 in front.
Fukuyama's yellow card for a high tackle then briefly reduced Japan to just 13 men but there was no further scoring before the break.
In the second-half Portela's penalty stretched his side's lead to 10 points but with Japan back at full strength Mamoru Harada's try, converted by Fukuyama, brought them back into the contest.
Portugal again added daylight after Storti's ninth try of the tournament, but the conversion was missed with the score now 29-21.
Portela then missed with a penalty, which proved crucial in the end, and his side conceded a penalty try when their scrum collapsed under Japanese pressure.
It was now just 29-28 to Portugal, but the Europeans thought they had claimed a first title when Francisco Salgado hared over for a try on the right wing.
The conversion was missed to leave the Portuguese 34-28 in front in the last minutes.
They could not hold on as Kawase spun over for his try with Fukuyama enjoying an easy conversion.
The match was a repeat of the 2017 final, also won by Japan.
Tonga beat Uruguay 29-27 to win the bronze medals.