NEW YORK — Google has agreed to pay $7 million as a result of an investigation brought by a coalition of state attorneys general, officials said Tuesday, in one of the largest fines for ­violating privacy in the digital age.

Massachusetts Attorney General Martha Coakley said the Bay State will receive about $327,000 as part of the settlement.

The fine stems from the Street View case, in which Google deployed special vehicles to photograph the houses and offices lining the world’s streets. But for several years the company was also secretly collecting personal information — e-mails, medical and financial records, passwords — as it cruised by. It was data-scooping from millions of unencrypted wireless networks.


‘‘Consumers have a reasonable expectation of privacy,’’ George Jepsen, Connecticut’s attorney general, said in a statement Tuesday. ‘‘This agreement recognizes those rights and ensures that Google will not use similar tactics in the future to collect personal information without permission from unsuspecting consumers.’’

As part of the settlement, Google agreed that it acted improperly and said it would engage in a comprehensive employee education program about privacy, as well as inform the public about securing wireless networks and protecting personal information.

Thirty-eight states participated in the investigation.

Google has repeatedly been faulted by regulators for privacy violations. Last summer, the search giant paid $22.5 million to settle Federal Trade Commission charges it had bypassed the privacy settings on Apple’s Safari browser. That fine, the largest civil penalty ever levied by the FTC, came after Google agreed to be audited by the agency for 20 years for privacy violations related to a social networking feature.

Some of Google’s most severe critics, who feel that the company is so big and powerful that it often eludes censure, said they were pleased with the attorneys generals’ actions.

“This is a significant privacy decision,’’ said Marc Rotenberg, executive director of the Electronic Privacy Information Center. He noted that the settlement figure was more than 200 times the amount the Federal Communications Commission fined Google last year for obstructing its own Street View investigation.


Still, the fine is a pittance for Google, which has net income of about $32 million a day.

‘‘It is the public opprobrium, not the money, that counts in these cases,’’ said David Vladeck, a professor of law at Georgetown University who previously directed the FTC’s Bureau of Consumer Protection. ‘‘And I think people were rightly unhappy with Google’s collecting the information in the first place and then Google’s lame explanation.’’

Google initially denied that any data had been collected from unknowing individuals, then sought to play down what it had and fought with regulators who wanted to examine it.

‘‘We work hard to get privacy right at Google,’’ said Niki Fenwick, a spokeswoman. ‘‘But in this case we didn’t.’’

She added that Google has since improved its systems.

The attorneys general probe began in June 2010. Richard Blumenthal, then Connecticut’s attorney general, said his office would lead a multistate investigation into what he called ‘‘Google’s deeply disturbing invasion of personal privacy.’’

In December 2010, Blumenthal issued a civil investigative demand, equivalent to a subpoena, to get the data. Google, however, never gave Connecticut any data.