Members of a South Texas community that has served as the hub of Elon Musk’s rocket launch company, SpaceX, voted on Saturday to formally establish a new city called Starbase, fulfilling one of Mr. Musk’s long-held dreams.

All but six of the 218 people who voted supported incorporating the city of Starbase, according to Cameron County, which administered the vote.

There were 283 eligible voters, said Remi Garza, the elections administrator for the county.

The community, known to locals as Boca Chica, covers about 1.5 square miles on a spit of land that brushes up against the Mexican border.

SpaceX broke ground in the area in 2014, and it has since become the company’s central hub and launch site, as well as home to hundreds of its employees.

On his social media platform, X, Mr. Musk has referred to the area as Starbase more than a dozen times in the past four years.

“My primary home is literally a ~$50k house in Boca Chica / Starbase that I rent from SpaceX,” Mr. Musk wrote in June 2021. “It’s kinda awesome though.”

In December, people living around the company offices and launch site filed a petition to officially establish the city of Starbase, Texas.

The petition described a community of about 500 inhabitants, including at least 219 primary residents and more than 100 children. Nearly everyone is a renter and works at SpaceX, according to the petition.

The municipality would be eligible to create its own police and fire departments, as well as to adopt its own ordinances, though it does not have to.

“Cities are required by law to do very little,” said Alan Bojorquez, a lawyer in Austin who specializes in helping Texans through the process of incorporating new municipalities.

Road maintenance is one of the most significant practical issues and would no longer be handled by the county. But, as a municipality, Starbase would be eligible for state and federal grants, would have certain immunity from lawsuits and could also condemn property, Mr. Bojorquez said.

“Starbase started with one shovel,” Mr. Musk said on X shortly after the vote was finalized.

J. David Goodman contributed reporting.