BERLIN — Germany on Sunday barred groups of more than two people from gathering, except for families, and Chancellor Angela Merkel later said she herself was going into isolation because her doctor had tested positive for the coronavirus.

Ms. Merkel said she would isolate herself at home effective immediately after learning that a doctor who vaccinated her against pneumonia on Friday was infected, her office said in a statement. The chancellor will be tested regularly in coming days while carrying out her duties from home.

News that their leader was in quarantine quickly overtook headlines about the far-reaching social-distancing measures she had just announced.

The new rules, which will be in place for at least two weeks, are among the strictest imposed by any country on movement outside the home, and they came as global infections surpassed 300,000 and the death toll topped 13,000. In Germany, the number of confirmed cases had risen to more than 23,900 by Sunday, with more than 90 deaths.