Japan, who had also shocked Germany in their opener in Qatar, finished top of Group E to reach the last 16, a stage where they have faltered three times before.
They will play 2018 runners-up Croatia for a place in the quarter-finals.
“Doha Delights Again!” one newspaper headlined its online edition, evoking memories of what the media called the “Miracle in Doha” after Japan’s win over the Germans.
Fans chanting “Nippon” poured into Tokyo’s iconic Shibuya crossing before sunrise, jumping up and down and shouting “Fight, fight, fight!” as police struggled to control the crowd.
“I never thought Japan would advance first place in the group. Thank you Japan! I love you guys!” said 19-year-old Yusei Sato, wearing Japan’s Samurai Blue national team jersey.
Takuya Kudo, 23, was in tears as soon as he saw Japan win.
“I’m just so happy,” he said. “Honestly, I never thought Japan would do this well. I’m just really thrilled.”
Fans lingering in Shibuya pressed high-fives on bleary commuters making their way to work from one of Tokyo’s busiest stations.
Social media exploded with joy, exulting “Samurai Blue!” and “Came from behind to win!,” with some fans posting manga-style drawings of a cheering player in a team uniform.
Another posted a cartoon of three dragons draped in national flags. The Japanese dragon was roaring while the Spanish dragon eyed Germany, which looked befuddled.