SAN JUAN, Puerto Rico — Drummers beat the goatskin covers of rum barrels while a singer led a chorus in call and response. A dancer emerged from the crowd, tipping an imaginary hat to the lead drummer. It’s a gesture that says the bomba has begun.

This playful exchange between dancers, singers and drummers is the rhythmic backbone of Afro-Boricuas here. Developed in the 17th century, when the Spanish were still in control, it is one of the oldest musical traditions on the island. Some of its earliest practitioners were West Africans working on sugar plantations; their bomba dances offered a means of social connection and catharsis, and, according to the ethnomusicologist Salvador E. Ferreras, sometimes helped them to disguise revolts.

These days, bomba offers a different kind of diversion. The mayor of San Juan danced the bomba with Ricky Martin. And recently, the filmmaker Spike Lee was here filming bomba scenes for the second season of “She’s Gotta Have It.” It’s an art form on the verge of becoming mainstream.