TOKYO — There are no laws telling you what to do, but everyone knows the rules. Wear your mask, keep your distance, sanitize your hands, have your temperature checked. Don't touch, don't shout. Don't cheer at soccer matches, and don't scream on amusement park rides. (But if you catch the virus, it just might have been your fault.)

It may sound like a dystopian vision of a plague-infected future from the latest Netflix series, but it also happens to be Japan’s solution to one of the most pressing problems facing the world today — how to coexist with the novel coronavirus.

With infections falling here even as they rise worldwide, Japan thinks it might have finally cracked the coronavirus code.

Smart science and peer pressure have combined to keep the virus broadly in check without legal penalties or a formal lockdown. The country is seeking that elusive middle ground between Chinese crackdown and Swedish permissiveness, presenting itself as a model for what White House coronavirus adviser Anthony S. Fauci calls the new era of pandemics.

“From the beginning, we’ve been trying to suppress the transmission as much as possible while maintaining social and economic opportunities,” said Hitoshi Oshitani, a Tohoku University virology professor who has been one of the government’s leading advisers on the pandemic.

“With our legal system, we can’t do what China did. Korea and Singapore are doing a lot of testing, but our PCR [testing] capacity was initially limited,” he said. “So we’ve been trying to find a different approach.”

Months before the rest of the world woke up to masks and the dangers of confined spaces and dense crowds, Japan set out to find a way to live through the pandemic without a draconian lockdown.

Back in May, more than 100 industries drew up guidelines on how they intended to conduct business while minimizing coronavirus transmission. Restaurants threw open their windows and spaced out their customers, shops placed assistants behind plastic screens, bars closed early, and sports resumed in sparsely populated, eerily quiet stadiums.

Tokyo’s commuter trains largely emptied during a state of emergency in April and May but are now fairly crowded once again — but with windows open and masks on.

In a country where fear of standing out is almost as intense as fear of the coronavirus, most people respect the guidelines: One study published in August found that the main reason people gave for wearing masks was “peer pressure,” rather than preventing the virus from spreading.

Oshitani places Japan’s approach in a cultural context. “Coexistence” with the virus rather than attempting to eliminate it makes sense in a country that has suffered many waves of deadly epidemics over the centuries, from smallpox to cholera, influenza and measles.

“There are many stone monuments in Japan to the smallpox god,” he said. “For the Japanese, it is something very powerful that is out of our control, something we respect. We accept that this is something that cannot be eliminated. In fact, the vast majority of infectious diseases cannot be eliminated.”

Cultural factors have also played an important role in Japan’s acceptance of mask-wearing, its emphasis on hygiene, its conformity to rules.

But just as important as culture has been smart science — and an early wake-up call.

The Diamond Princess cruise ship, a vast “petri dish” anchored off the port of Yokohama, gave Japan’s scientists a vital head start in analyzing disease transmission and a clue to the unique properties of the coronavirus.

Alarm bells started ringing when seven or eight quarantine officers, nurses and officials caught the virus on the ship.

“The quarantine officers, they’re professionals, they know how to protect themselves,” Oshitani said. “That’s why we suspected there must be an unusual mode of transmission.”

The virus, Oshitani’s team concluded, seemed to be spreading through microdroplets — not just through coughs, sneezes and contact, but in microparticles floating and circulating in the air, what scientists call “aerosol transmission.”

By mid-February, the disease was also spreading throughout Japan, and the epidemiological data was leading Oshitani’s team to two other surprising conclusions.

The first was that people with few or no symptoms could pass on the disease. The second was related to a phenomenon now known as “superspreader events.”

Unlike with influenza, where sick people might pass the disease to two or three others, most people infected with the coronavirus — almost 80 percent — weren’t passing on the virus to anyone at all. Instead, a small minority of people were infecting many others at the same time, often in crowded, poorly ventilated places where they came into close contact and engaged in conversation.

Those conclusions are now accepted by many scientists around the world, but it took months for the Japanese findings to gain broad backing. Meanwhile, at home, they formed the basis for the country’s approach to tackling the coronavirus.

Mask use was critical in containing a virus spreading through the air, while scientists concentrated on spotting and eliminating clusters of infection.

“Covid-19 transmission cannot be sustained without forming clusters,” Oshitani says.

That simple conclusion shaped Japan’s unique alternative to harsh lockdowns: the notion that the spread of the virus can be controlled if people simply avoid the riskiest settings, what are known as “san mitsu,” or the 3C’s — closed locations with poor ventilation, crowded places, and close-contact settings where conversations are taking place.

Walking in the park and even jogging were fine: There was no need for people to be prisoners in their own homes. Children could go back to school, albeit in a masked and distanced environment.

The approach has its critics. Many scientists and medical professionals complain that the lack of testing has been a major handicap in tracking the disease — and the barriers to getting a test have certainly made many ordinary people frustrated and scared.

The central government’s response has often appeared slow and confused, and its performance scores very poorly in public opinion surveys. Compared with the records of many of its East Asian and Southeast Asian peers, Japan’s looks considerably less impressive, with Thailand, Vietnam and South Korea all recording far fewer deaths and emerging from the crisis more quickly.

While normal life resumes in China and in Taiwan, Japan is still facing a wave of bankruptcies and unemployment. From that perspective, Japan’s middle way sometimes looks more like muddled compromise than a stroke of genius, critics argue.

Relying on peer pressure also has a nasty side effect, Oshitani acknowledges, leading to discrimination against infected people and health-care workers.

Nor does it always work. Citing research from the National Institute of Infectious Diseases, Oshitani says the latest outbreak of the coronavirus appears to have come from a single source — most probably a club in a Tokyo nightlife district that ignored the new guidelines.

Now, as infections ebb, Japan is beginning to relax its lifestyle guidelines in a bid to revive the economy. Whether it can do that without sparking another deadly wave of infections will be an acid test for its strategy.

Akiko Kashiwagi contributed to this report.