The late-night host performed a special rendition of "The Story of Tonight" in costume with Miranda and the cast during Tuesday's episode of The Tonight Show starring Jimmy Fallon in Puerto Rico.
Fallon joined Miranda, John Laurens, Hercules Mulligan and Marquis de Lafayette onstage during a scene at a pub. He changed the lyrics to reflect the night's show.
"We've got a killer show tonight," Fallon sang. "In Puerto Rico for tonight."
Miranda and the Hamilton cast are in Puerto Rico for a limited run of the musical. He hopes to raise about $15 million for Puerto Rican artists and art institutions, in addition to bringing attention to the area in the wake of Hurricane Maria.
Fallon interviewed Miranda, who was born in New York to Puerto Rican parents, onstage during the episode.
"It's really thrilling," Miranda said of reprising Alexander Hamilton. "It's really incredible."
"There's not a more resilient people than the Puerto Rican people, and the aftermath of Hurricane Maria sort of proves that," he told Fallon. "To bring it back here was so emotional."
Hamilton kicked off a 17-day, 23-performance run at the Centro de Bellas Artes Luis A. Ferré Friday in San Juan.