California has passed a landmark privacy bill that restricts the data-harvesting practices of technology companies like Facebook, Google and Amazon and gives consumers more control over their personal information.

The California Consumer Privacy Act is designed to provide new protections to the state’s 40 million residents in the wake of major privacy breaches including the Cambridge Analytica scandal.

The new rules give Californians the right to see what information is being collected about them and to request that data be deleted, to find out whether their information is being sold to third parties including advertisers and to request that they stop doing so.

Consumer protection groups celebrated the passing of the bill as a major victory.

“The Consumer Privacy Act will allow consumers to take control of and make informed choices about their own data, control that fosters a healthy relationship to technology and overall digital wellbeing,” said Elizabeth Galicia, from Common Sense Media, which co-sponsored the bill.

“Kids are the most tracked generation ever. Their personal information, activities and networks are exposed and often for sale from birth. This law is a strong first step in protecting kids and all consumers,” she added.

“This bill will be the strongest of its kind in the nation and enact safeguards we need in the 21st century,” said Senator Bill Dodd, one of the bill’s co-authors, ahead of the vote on Thursday. “Big data is big business. It’s time we regulate it appropriately and hold bad actors accountable.”

The bill is slated to come into effect on 1 January 2020. Companies could be penalised up to $7,500 for each violation. The rules will be enforced by California’s attorney general.

Facebook, Google, Comcast, AT&T and Verizon all donated $200,000 to create a $1m fund to oppose the California Consumer Privacy Act (although Facebook has since withdrawn its opposition) and they are likely to spend the coming months lobbying to water down the law.

“While this law adds a significant new layer of privacy protections for California consumers, even its authors have acknowledged it is far from perfect and will need revisions in the months ahead as its consequences and workability are better understood,” said Linda Moore, president and CEO of the lobby group TechNet.

The law was introduced late last week by the state senators Rob Hertzberg and Bill Dodd and the assembly member Ed Chau in a rush to pre-empt a stricter privacy ballot initiative that had gathered more than 600,000 signatures from Californians. The group behind the ballot initiative, Californians for Consumer Privacy, agreed to withdraw the ballot if the bill was passed this week.

The Internet Association, a technology trade group whose members include Amazon, Facebook, Google and Microsoft, expressed concern over the speed with which the law was passed.

“Data regulation policy is complex and impacts every sector of the economy, including the internet industry. That makes the lack of public discussion and process surrounding this far-reaching bill even more concerning,” said Robert Callahan, vice-president of state government affairs.

“It is critical going forward that policymakers work to correct the inevitable, negative policy and compliance ramifications this last-minute deal will create for California’s consumers and businesses alike.”

The passing of the law comes the month after Europe introduced similar sweeping privacy protections under the General Data Protection Regulation (GDPR).

GDPR gives individuals the right to demand companies reveal or delete the personal data they hold and regulators can work together across Europe for the first time, rather than launching separate actions in each country. It also introduces harsh penalties, with a maximum fine of €20m or 4% of the company’s global turnover.