As part of what Timothy D. Cook, Apple’s chief executive, called “the largest album release of all time,” the company released U2’s new “Songs of Innocence” free through iTunes on Tuesday, just after the band performed a new song, “The Miracle (Of Joey Ramone),” at the close of Apple’s product announcement event in Cupertino, Calif.

For what Apple said were up to 500 million customers in 119 countries, “Songs of Innocence” simply appeared in their iTunes accounts on Tuesday afternoon. But the deal that led to that release was carefully negotiated between U2 and some of the most powerful entities in music, including Apple; Universal, the band’s label; and Guy Oseary, U2’s new manager. Mr. Oseary works in the management division of Live Nation Entertainment, the global concert conglomerate.

To release U2’s album free, Apple paid the band and Universal an unspecified fee as a blanket royalty and committed to a marketing campaign for the band worth up to $100 million, according to several people briefed on the deal. That marketing will include a global television campaign, the first piece of which was a commercial that was shown during the event.

Bono, U2’s lead singer, alluded to the deal himself at Apple’s event. After the band performed, he and Mr. Cook playfully negotiated over how the album could be released through iTunes “in five seconds.” Mr. Cook said it could if the album was given away free.

“But first you would have to pay for it,” Bono said, “because we’re not going in for the free music around here.”

Mr. Oseary, who took over management of the band less than a year ago, stressed in a phone interview after the event that the music still had value even though it was being given away.

“This is a gift from Apple to their customers,” Mr. Oseary said. “They bought it and they are giving it away.”

Apple and U2 have had a close association going back at least a decade, when Apple introduced a U2-themed iPod, and the promotion on Tuesday seemed to bring benefits to both parties. Although U2’s album deal seemed to have little to do with the new iPhone and smartwatch that Apple introduced, its appearance closed the event with celebrity power and also underscored Apple’s continuing importance to the music industry.

And for U2 and its label, the deal satisfies what has become a requirement for any major album release in an era of diminished sales: a big, attention-grabbing media event to advertise the album and create online conversations. Through the deal, U2 is also effectively advertising its back catalog, an increasingly important piece of U2’s business. The band’s last release, “No Line on the Horizon,” from 2009, sold just 1.1 million copies.

“Songs of Innocence” will remain free through iTunes until Oct. 14, when Universal will begin selling the album at stores and begin to make it available through streaming services like Spotify.