Despite the pandemic, the one-year delay and the soaring costs, the Japanese public may still find a sweet spot for the Tokyo Olympics, the way it did for the storied 1964 Games.

Why? A historic haul of medals.

Japan had its best Olympic production in every category: the most gold medals (27), the most overall (58), and a third-place finish in gold medals behind two much larger countries — the United States and China.

CLICK HERE FOR MORE SPORTS COVERAGE ON foxnews.1eye.us

"Japan’s national team was able to make its own record result this time," deputy delegation head Mitsugi Ogata said Sunday as the Olympics ended. "We don’t want this to be like disappearing fireworks. We think it is important that we keep this momentum going through Paris 2024, and Los Angeles 2028."

The previous best in gold was 16, both in 1964 and at the 2004 Athens Games. The country won only 12 gold medals five years ago in Rio de Janeiro.

The United States won 39 gold medals — one more than China — and was way ahead in the overall medal standings with 113 compared to 88 for China. The Russian Olympic Committee had 71 overall medals followed by Britain with 65. Japan was fifth.

Home countries always get a medal bump, usually by investing more time and money than they would ordinarily. With no fans, some of that home-field advantage was lost. Still, Japan made up for the lack of fans by winning medals in the five sports added to this year's Olympic program: baseball-softball, sports climbing, karate, surfing and skateboarding.

Each Olympic host gets to add a few sports. Paris will have breakdancing, surfing, karate, and sports climbing.

Japan won gold in both baseball and softball — beating the United States both times in the final — added three gold medals in skateboarding, and another gold in karate. Of its 58 overall medals, 14 came in the sports added for Tokyo.

Atsunori Inaba, the manager of Japan's winning baseball team, said the gold medal might get more children playing. Though very popular in Japan, baseball participation numbers are down.

"I hope this gold will contribute to increasing the number of both children and adults who want to start playing baseball," Atsunori said.

Japan's goal before the pandemic was 30 gold medals. But officials backed off that target in the last several months as it became more difficult during the pandemic to predict Japan's performance, as well as forecast how other countries would perform.

"Originally we had a goal of winning 30 gold medals." Ogata said. "Although we were not able to achieve that goal, the number of gold medals, total medals, are all all historic highs."

Japan got off on the right foot on the first day of the Olympics — in judo, of course. Judo is the only Olympic sport with roots in Japan, and the country's athletes won nine gold medals, two silver and one bronze.

In the first judo final, Funa Tonaki earned silver in the women's 48-kilogram class. It was Japan's 500th Olympic medal — winter and summer — followed by a gold medal from Naohisa Takato in the men's 60-kilogram final.

That helped get the ball rolling, catching a public's attention that had been distracted by rising COVID-19 cases and uncertainty about the Olympics even taking place.

Among the successes, Japan won five gold medals in wrestling — four by women — and upset China for gold in table tennis in mixed doubles.

CLICK HERE TO GET THE FOX NEWS APP

It even reached the gold-medal final against the United States in women's basketball, losing 90-75. It was Japan's first medal in women's basketball, a team coached by American Tom Hovasse.

Tsuyoshi Fukui, the head of the Japanese delegation, confirmed Sunday that gold medalists would receive 5 million yen — about $45,000. Silver is worth 2 million (about $18,000), with 1 million (about $9,000) for bronze.

It will be large payday.