Beyonce performs during the Formation World Tour

Beyonce performs during the Formation World Tour at Stade de France on July 21, 2016 in Paris, France.

 Daniela Vesco/Invision for Parkwood Entertainment/AP Images

The track had already become the first all-Spanish language song to hit No. 1 on Spotify's Global Top 50 chart, and then a certain 5-year-old tastemaker got involved.

On Thursday evening, Beyonce shared a 20 second video on Instagram announcing she had joined a remix of J Balvin and Willy William's hit "Mi Gente" and would donate all her proceeds to disaster relief charities for Puerto Rico, Mexico and the other recently affected Caribbean islands. 

Following in the footsteps of Luis Fonsi and Daddy Yankee's record-breaking success with the Justin Bieber-featuring "Despacito" remix, Beyonce's good news with a good cause marked a big moment for Latin music in the mainstream. With Queen Bey singing in both Spanish and English on the track, it and its star-studded music video racked up millions of streams in its first 24 hours, topping iTunes' sales chart and YouTube's trend ranking, and looks prime to hit the Hot 100 top 10. 

Here's how the collaboration came to be:

A remake of an original song by French DJ Willy William, "Mi Gente" had the makings of a global hit when it was first released in April and immediately sparked talk of a general market remix. "But we wanted it to live for a while and get as big as it could on a global scale in Spanish," says Rebeca Leon, who co-manages Balvin with Balvin's label, Universal Music Latin Entertainment (UMLE). 

The "lofty goal," says UMLE president Victor Gonzalez, "was to make it No. 1 on Spotify at a global level."

After trailing "Despacito" (also released via UMLE) for that top Spotify spot, on Aug. 1 "Mi Gente" hit its mark and usurped the mega-hit, becoming the first-ever all-Spanish language song to dominate the streaming platform's Global Top 50 chart. That would have been impressive enough, but from there the track found new life thanks to the ear of a highly influential 5-year-old tastemaker. 

Balvin already had collaborated with multiple mainstream artists in different capacities, including Bieber and Pharrell Williams, and remixes with any number of names were infinitely possible. While many expressed interest, Beyonce was at the top of the list. To Balvin and his team's surprise, when asked, she said yes -- motivated in part, they learned later, by her daughter Blue (Azul in Spanish) and her love of the song. 

"We reached out, never thinking they would say yes," says Leon. But within weeks Beyonce was recording the Spanish version, written by Sky, Balvin's producer, with help with from Fonsi's brother, Jean Rodriguez. 

She also added lines in English, shout-outs to her native Houston and, of course, probably the most famous line of all: "Azul, are you with me?" "Oh, yes I am," answers Blue herself.

Gonzalez says the whole thing came together surprisingly easily. 

"There seemed to be a script that said, 'Lets make this possible,' and we all followed it," he tells Billboard. "It wasn't a formula. It had to be legitimate for it to happen."

As the "Mi Gente" remix's release followed the aftermath of hurricanes Harvey and Maria, along with the devastating 7.1 magnitude earthquake in Mexico, Beyonce seized the moment and announced her intent to use the song to benefit charities including Cema, Unicef and Somos Una Voz. 

To underscore the message, she added a line to the song: "Lift up your people, Texas, Puerto Rico, dem islands to Mexico."  

"The power of the music goes beyond any language and any strategy," says Balvin. "I am beyond grateful to have the Queen B join us. It's a dream come true."