For Japan, this was a break from its own victimhood. Because of its women’s soccer team, thousands packed bars here during vampire hours. They chanted their country’s name. They chewed on towels and covered their eyes. Finally, they went wild with joy.

Japan’s penalty shootout victory over the United States on Sunday didn’t so much rekindle Japan’s national pride — even in mourning, that never ebbed — but it gave this recovering country a reminder of why that pride existed in the first place.

Until the earthquake, tsunami and nuclear meltdown of four months ago, Japan was a country known foremost for its dignity and high achievement. Its trains ran faster, its food tasted better, its athletes trained harder. As it turned out, Japan managed to build an elite women’s soccer team despite scant girls’ participation nationwide. It did so with hard work — identifying elite players early, then making them practice for 10,000 hours, or more than 21 / 2 hours daily over 10 years.

Many fans here didn’t know of the Women’s World Cup — or of the Japanese women’s team’s abilities — until days ago, after a quarterfinal upset of Germany. Then Japan embraced its Nadeshiko, as the women’s team is known. Its romp to the finals turned into front-page news. The prime minister talked about it. The match against the United States began at 3:45 a.m. local time, but at one Tokyo sports bar, twenty- and thirty-somethings were packed in elbow to elbow, arriving early enough to sing the country’s national anthem.

“The Japanese people,” said Toshihiro Higaki, 26, “needed something they can be proud of.”

Much as television broadcasters talked about the soccer team’s ability to inspire the country, the opposite was also true: The country inspired the soccer team. Before the team’s semifinal game, coach Norio Sasaki, during a pep talk, told his players to think about the disaster victims from the March 11 earthquake and tsunami.

The team’s recent history also gave it a strange connection with the disasters. In 2009, it held a training camp at the J-Village athletic complex in Fukushima, now a staging site for nuclear workers at the hobbled Fukushima Daiichi plant. Several players had been members of the Tepco Mareeze women’s club — a now-defunct member of the Japanese pro league. Midfielder Aya Sameshima even worked at the nuclear plant well before it became the object of the world’s anxiety.

The members of the team served as fitting ambassadors for Japan, in large part because they reflected the perseverance the country has shown in the past four months. Against the U.S. team, they trailed twice. They scored in the second half to tie it. They scored late in overtime to tie it again. After the second goal by Japanese captain Homare Sawa on a deflected corner kick, a roar in a sweltering bar rose from seven time zones away.

“Nippon!” Clap-clap-clap. “Nippon!”

At least when the match began, though, Japanese supporters tried to temper their expectations. Nadeshiko’s starters had an average height of 5-foot-4 — a distinct size disadvantage. In 25 matches against the United States, Japan had never won. And early in this match, the U.S. controlled play, pelted shots at every part of the net but the backside, and Japanese bargoers made noise mostly when anticipating something bad.

But that changed. That changed because Japan wouldn’t fade. Tokyo’s sports bars turned loud — all chanting and spilled beer. And after Japan had won in the penalty kick shootout, Sawa was asked by a television reporter whether she had a message to send back home. “Thank you, everybody,” she said.

Asuka Fujiwara, 30, who had been standing in the sports bar for 21 / 2 hours, held her hand to her heart.

Fujiwara called it “the first uplifting national story in months.”

The Nadeshiko had finished in fourth place at the 2008 Olympics in Beijing, but the team’s run to the finals this time caught many by surprise. Only about 25,000 girls and women play soccer in Japan — indicative of a country that does too little, critics say, to nurture its female talent. At least in soccer, though, Japan has found a way to capitalize on the talent that enters the system. Each of Japan’s 47 prefectures has a well-organized training academy. National team coaches attend tournaments of girls as young as 12. Those who excel receive relentless coaching.

“The best players just log so much practice time, and they’re taught good technique,” said Tom Byer, who has spent 20 years working to develop youth soccer in Japan. “But the overall pool is still small. When I do clinics with 1,000 kids, maybe 20 are girls.”

For now, the women’s national team has converted fans more than it has inspired future players. Because of the start time, some fans at Tokyo sports bars stayed up all night, switching from beer to water as the sun rose. Other fans tried to catch a few hours’ sleep, setting their alarms for 3 a.m.

At one sports bar in Ebisu, a small pocket of Americans rooted for the United States, but Japanese fans showed no animosity; indeed, the country’s militaries had cooperated in the aftermath of the disaster, and the tightened alliance translated even onto the soccer pitch. Japanese fans said they were rooting for their country, but they weren’t rooting against the United States.

“It’s really touching,” Higaki said, as the women’s team received its trophy. “I thought Japan would lose, but in the end, I wouldn’t change a single moment.”

Special correspondent Sachiko Iwata contributed to this report.