SAN JUAN, P.R. — The uneasy calm that had settled over Puerto Rico after huge protests brought down one governor and a second one was installed in his place ended on Wednesday when its Supreme Court ruled that the only way to maintain the constitutional order was to swear in the island’s third governor in a week.

In short order after the high court ruling, Pedro R. Pierluisi, who had filled the position since Friday, stepped down. Wanda Vázquez, the former secretary of justice, took the oath as governor, just the second woman to hold the office. And Puerto Rico was thrust into a new period of political tumult over how long the unpopular Ms. Vázquez might remain on the job — and what machinations might be underway to prepare for her possible succession.

After a dizzying month full of remarkable moments, Wednesday’s turn of events might have given Puerto Ricans confidence in their rule of law, but the continuing saga offered little certainty over what the leadership of their troubled government might look like in the coming months.

Chief Justice Maite D. Oronoz Rodríguez called the past few weeks “the most important juncture” in Puerto Rico’s history as a democracy.