After Hurricane Maria devastated the island late last month, only 7 percent of Puerto Rico has power back as of this week, ABC News reports, and less than half have regained access to water.
Miranda, the creator and originator of the title role of Hamilton on Broadway, knows firsthand how people with family in Puerto Rico felt after the hurricane hit.
"There was this terrible silence while we all waited to hear from our families," he told Good Morning America, "and my social media, my Facebook, my Twitter, was filled with, my friends and my family: 'Has anyone heard from Isabela? Has anyone heard from San Juan?'"
Those social media posts inspired Miranda to write a song that included the names of all the towns and cities on the island. In "Almost Like Praying," he also employs lyrics from the musical West Side Story, which features Puerto Rican characters.
In two weeks, the Emmy, Grammy and Tony-winning artist wrote the song, coordinated with the artists, and recorded the track, which was released late Thursday. A prolific Twitter user, Miranda said that he tweeted at artists he wanted to include whose phone numbers he didn't have.
He gave a shout-out to all the artists included in the song on Twitter, including Jennifer Lopez, Luis Fonsi of "Despacito" fame, Rita Moreno and Camila Cabello.
With so many stars involved, putting the song together required "everyone moving mountains," Miranda said. Puerto Rican rapper PJ Sin Suela was first able to reply to Miranda less than a week ago when he regained power, and he was unable to send his recording. Fortunately, Gloria Estefan, who is also involved, had plans to travel to Puerto Rico.
"I go, 'Can I get you a memory stick?'" Miranda recalled. "That night I get an email, it's a picture of Gloria Estefan and Emilio Estefan holding the memory stick. And he [Sin Suela] is on the track."
Miranda said 100 percent of proceeds will go to the Hispanic Federation, a group of Latino nonprofits in the United States, which is currently raising money for Hurricane Maria victims.
The song is available on iTunes, Google Play and elsewhere.