Google (Nasdaq: GOOG), the No. 1 search engine, will pay a record fine of $22.5 million to the U.S. Federal Trade Commission to settle a complaint it had abused the privacy of users of the rival Safari browser from Apple (Nasdaq: AAPL), the world's most valuable technology company.

The penalty is the largest ever paid to the FTC. Google, of Mountain View, Calif., reported second-quarter cash and investments exceeding $43.1 billion.

The FTC alleged Google has illegally inserted software "cookies" on Safari users who visited Google's DoubleClick advertising network "for several months in 2011 and 2012." Google had advised them that they would be automatically opted out of advertising tracking, though.

"No matter how big or small, all companies must abide by FTC orders against them and keep their privacy promises to customers," said FTC Chairman Jon Leibowitz. If not, "they will end up paying many times what it would have cost to comply in the first place."

Google isn't the only company to have settled such charges: last year, Facebook (Nasdaq: FB), the No. 1 social networking site, agreed to desist from cookie inserts and to be monitored by the FTC for 20 years.

Google shares rose $1.41 to $643.68 after the settlement was announced on Thursday.