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.

Apple said in a statement Wednesday that the new center would keep “strong data privacy and security protections in place.” The company added that no back doors, meaning ways for the government or other organizations to get around Apple’s encryption protecting the data, would be created in its systems.

“The addition of this data center will allow us to improve the speed and reliability of our products and services while also complying with newly passed regulations,” Apple said.

China’s rules also call for security reviews and for users of messaging apps to register their real identities. The regulations are part of a Chinese industrial policy adopted to build local capabilities. For example, a government plan called Made in China 2025 names several industries, including robotics and electric cars, in which China hopes its companies will become leaders. Foreign business groups have said the laws unfairly discriminate against companies that are not Chinese.

The iPhone is a symbol of middle-class ambitions in China and is the foundation of Apple’s business in the country, which accounts for 21 percent of the company’s global sales, making it Apple’s most important market after the United States.

But the iPhone has also become emblematic of China’s long reliance on foreign technology. Even before China passed the cybersecurity law last year requiring that the online data of its citizen be stored domestically, the country was pressuring foreign technology companies to operate its computer servers within its borders.

Apple already stores some of the data of China’s residents in local servers, but the new agreement goes one step further with a Chinese partner responsible for running its data center, managing the sales of its services in the country and handling legal requests for data from the government.

In 2014, Apple first moved some of the data of its Chinese customers that had been overseas to a domestic plant operated by China Telecom. The change occurred shortly after state-run China Central Television raised security concerns that Apple was tracking the locations of iPhone users.

Careful not to offend, Apple said it “appreciated” that CCTV had flagged the issue but explained that the company did not have access to its users’ locations.

The opening date for the new data center has not been set, but when it does open, Apple’s iCloud will operate from an Apple plant run by Guizhou-Cloud Big Data Industry, a data management company. That means that if Apple customers in mainland China want to buy additional iCloud storage in the future, they will do so through Apple’s Chinese partner.

Apple said, however, that it would retain the encryption keys for the data stored at its center and that Guizhou-Cloud Big Data would not have access, meaning it would not be able to see what photos or documents were stored in iCloud without Apple’s permission. This is the first time that Apple has formed a partnership with a local operator for its cloud services.

Other American technology companies have also moved data into China in accordance with the new law. Airbnb said last year that it was moving its user data to a domestic location, citing a need to comply with local laws.

Foreign companies like Apple have had to adapt in other ways to stronger Chinese government scrutiny, often by helping to expand Chinese technological capabilities. For instance, Apple said this year that it would establish two research and development centers in China. Last year, it invested $1 billion in Didi Chuxing, a Chinese ride-hailing service. Apple has been far more profitable in China than most of its Western peers, but that success has led to pushback from the government. More than a year ago, Apple’s iBooks Store and iTunes Movies were shut down in China, six months after they were introduced there.

In December, complying with what it said was a request from the Chinese authorities, Apple removed news apps created by The New York Times from its app store in China. Apple did not specify what had prompted the request. The company also must undergo “security audits” on new models of the iPhone before gaining approval to sell them in China.

Even though other American technology giants such as Facebook and Google are blocked in China, Apple has maintained a thriving business in the country by adhering to local rules. It also helps that Apple’s smartphones and computers do not carry the same political or security risks as social media platforms and networking equipment.

Paul Mozur reported from Shanghai, Daisuke Wakabayashi from San Francisco and Nick Wingfield from Seattle.