Allen Toussaint, the iconic R&B songwriter and performer who wrote such hits as “Ruler of My Heart” and “Lady Marmalade,” died early Tuesday morning after a performance in Spain, his daughter confirmed to the New York Times. He was 77.

The musician suffered a heart attack in his Madrid hotel and was revived by rescue workers, an emergency services spokesman told the Associated Press. But en route to the hospital, Toussaint suffered a second, fatal heart attack.

Born in New Orleans’ Gert Town neighborhood in 1938, Toussaint taught himself piano as a child. His big break came at the age of 17 when he was asked to fill in for Huey Smith at an Earl King performance. Over his storied career, Toussaint went on to collaborate with other legendary musicians, such as Lee Dorsey for the 1966 classic “Working in a Coal Mine,” Paul McCartney and Wings for the 1975 album, “Venus and Mars” and Elvis Costello for the 2006 post-Hurricane Katrina album “The River In Reverse.”

Many of the songs he penned spawned famous cover versions, reimagined by legendary artists such as Bo Diddley, The Rolling Stones and Robert Plant.

“I was so glad when the Stones recorded my song,” Toussaint once said in an interview. “I knew they would know how to roll it all the way to the bank.”

Toussaint was inducted into the Rock and Roll Hall of Fame in 1998, largely for the role he played in “not allowing (New Orleans) old-school R&B traditions to die out but by keeping pace with developments in the rapidly evolving words of soul and funk,” the citationread. “In addition, he brought the New Orleans sound to the national stage and it remains a vital and ongoing part of our musical heritage to this day.”

Toussaint was also inducted into the Louisiana Music Hall of Fame in 2009 and the Blues Hall of Fame in 2011. He was awarded America’s National Medal of Arts, the highest honor bestowed upon American artists, by President Obama in 2013.

Toussaint is survived by his son Clarence, known as Reginald, and his daughter Alison.

Celebrities and music industry giants tweeted their tributes to the revered musician upon hearing of Toussaint's death.