“We are quite surprised,” said Stefan Egli, a manager of Operation Libero, a politically independent group that campaigned in support of the initiative and organized the poster campaign featuring the two Vanessas, among others. Mr. Egli said he had thought the referendum would win the national popular vote, but he worried that more of the rural cantons would oppose the change.

Swiss law typically requires foreigners to be residents of the country for 12 years before applying for citizenship; after that they must undergo a series of tests and interviews to assess their suitability, and are judged by criteria that differ from one canton to another. Unlike the United States and some European countries, Switzerland does not grant automatic citizenship to children born on its soil.

The measure approved on Sunday will not change those basic rules, but will speed up and simplify the approval process, using uniform criteria, for foreigners under 25 whose parents and grandparents have permanent residence status in Switzerland. “These are people who are at home,” Simonetta Sommaruga, the federal justice minister, said in a statement explaining the government’s position on third-generation immigrants. “The only difference is they do not have a red (Swiss) passport.”

An assessment by Geneva University for the government’s department of migration found that just under 25,000 people could benefit from the changes. Most of them are Italian, it found, and nearly 80 percent are of European extraction.

Vanessa Seyffert, the second woman in the poster, will not be one of them; she is already deep in the process of applying the old way. She said she had taken part in the poster campaign to highlight the inequality facing young people who were brought up attending the same schools and speaking the same language but do not have the same rights. “The crucial thing for me is to be able to vote,” Ms. Seyffert said in an interview. “I just want to have a voice.”