BEIRUT, Lebanon — An American woman who was stuck illegally in Saudi Arabia with her young daughter after her Saudi husband divorced her said on Sunday that the Saudi authorities had granted her legal residency after The New York Times wrote about her ordeal last week.

The woman, Bethany Vierra of Washington State, moved to the kingdom in 2011, where she started a business, married a Saudi businessman and gave birth to a daughter, Zaina. Her troubles began after the divorce, when her former husband failed to renew her residency, meaning she was in the kingdom illegally but was also blocked from traveling through airports or accessing her bank account.

Ms. Vierra’s case showed how even an American woman and her Saudi-American daughter could be ensnared by the kingdom’s so-called guardianship laws, which grant Saudi men power over women in a number of ways.

Much has changed for women in Saudi Arabia in recent years, as the crown prince, Mohammed bin Salman, the day-to-day ruler, has pushed to open up society, lifting the ban on driving by women, allowing women to enter sports stadiums and appointing the kingdom’s first female ambassador, to the United States.