SHANGHAI — Apple said Wednesday that it would open its first data center in China, joining a parade of technology companies responding to growing global demands to build facilities that store online data closer to customers.

The move is a response to a strict new law in China that requires companies to store users’ data in the country. The new data center, in Guizhou, a province in southwest China, is part of a $1 billion investment in the province and will be operated in partnership with a local data management company, Apple said.

The move is part of a worldwide trend regarding the security and sovereignty of digital data. Microsoft, Amazon and Facebook are among the big American technology companies plowing billions of dollars into building data centers in Germany, the Netherlands, France and other countries. While some of the expansion is for technical reasons — the online services operate faster when they are near customers — the companies are also reacting to growing pressure from European governments and customers to maintain some control over their data.

As is the case with many laws, the digital security regulations approved last month in China were vaguely worded, leaving many foreign companies uncertain about which parts would be enforced and how. Already, Amazon, Microsoft and IBM have formed partnerships with Chinese companies to offer cloud computing services based in China. Apple, easily the most successful foreign technology company in China, had much to lose without a plan for its own data center in the country.