The Hospital del Nino is located in the capital San Juan and serves about 3,000 children across the island. The hospital also houses some 30 children with serious medical needs that require round-the-clock care.
A hospital spokesperson told Primera Hora last month that they were forced to ration diesel fuel and take other measures to ensure a constant flow of electricity.
Hurricane Maria also knocked down all of the trees surrounding the hospital, resulting in heat from the withering tropical sun beating down on the building and its surroundings.
Puerto Rico Gov. Ricardo Rossello replied "let's talk" and later said the two had a "great initial conversation."
Less than three weeks later, officials say the hospital is up and running with a solar system that supplies all of its electricity needs.
"I've never seen a team arrive so fast and work so fast. They built this in a week," Rafael Pagán, the hospital's chairman of the board, told Telemundo.
Just 25 percent of Puerto Rico's 3.4 million residents have electricity, according to the latest figures, and some 3,758 people are still in shelters nearly two months after Maria ravaged the island, causing widespread damages and killing 51 people.
Repairing Puerto Rico's badly damaged electrical grid could take months and cost billions of dollars. Musk has put forth his so-called solar microgrids, that produce energy locally through solar energy, as an alternative.
ABC News' Joshua Hoyos contributed to this report.