SEOUL, South Korea — The most important thing about this country’s legislative elections this week is the fact that they happened at all. They were the world’s first nationwide vote of the coronavirus era, and more than 29 million people — 66 percent of the electorate, the highest turnout in nearly three decades — cast ballots to choose 300 new members for the National Assembly.

Each polling station was equipped with hand sanitizer and disposable gloves; voters, wearing masks and standing far apart, had their temperatures checked at the entrances. No one seemed to feel they had to choose between exercising their democratic rights and protecting their health. As with widespread testing, so, too, with record voter turnout: South Korea is again a beacon in dark times, a model for how an open society can weather the storm of a pandemic.

Who would have predicted this six weeks ago? At the end of February, South Korea held the dubious distinction of having the highest number of Covid-19 cases outside China. Along with Italy and Iran, it was one of the first new hot spot countries, and a harbinger that the epidemic that started in Wuhan was on its way to becoming a global pandemic. I returned to Seoul with my family from an extended stay in Vietnam just as the number of daily infections was starting to spike: The airline we flew canceled all its flights to and from South Korea not long after. For a harrowing spell in late February and early March, South Korea felt like ground zero.

Before the outbreak, President Moon Jae-in and his liberal coalition, the Democratic Party, were in the doldrums. Mr. Moon had to let go of a controversial new justice minister and pull back on unpopular structural reforms, like a pledge to substantially increase the minimum wage. Economic growth was sluggish. Mr. Moon’s signature foreign policy of “peace and denuclearization” diplomacy with North Korea was stuck in gear, paralyzed by the lack of progress in negotiations between Kim Jong-un, the North’s leader, and President Trump.