Jerry Bock, a Broadway composer who wrote the memorable and emotionally resonant music for “Fiddler on the Roof” and other acclaimed theatrical productions, died Wednesday at a hospital in Mount Kisco, N.Y., of complications from a stroke. He was 81.

Bock and lyricist Sheldon Harnick produced the music for seven Broadway musicals between 1958 and 1970, including the Pulitzer Prize-winning drama “Fiorello!” (1959) and the Tony-nominated “She Loves Me” (1963). But with “Fiddler,” they touched a musical and mystical chord that remains undiminished.

Based on writings by the Yiddish-language author Sholom Aleichem, “Fiddler on the Roof” seemed to be an unlikely candidate for Broadway success when it premiered in 1964. The play — with a book by Joseph Stein, who died Oct. 24 — depicts Jewish life in the fictional Russian village of Anatevka at the turn of the 20th century.

In the original production, Zero Mostel played the lead role of Tevye, a dairyman with five daughters, with unforgettable verve. Jerome Robbins’ direction and choreography made “Fiddler” a visual spectacle.

From the simple opening theme played on violin, Bock’s heart-tugging music — including the songs “Matchmaker, Matchmaker,” “If I Were a Rich Man” and “Sunrise, Sunset” — helped make “Fiddler” an indelible part of popular culture.

The play was an immediate hit on Broadway and won nine Tony Awards, including best musical. Bock and Harnick shared a Tony for their score.

The play ran for eight years, and its 3,242 performances were a Broadway record at the time. It was made into a popular film in 1971, with Israeli actor Topol in the lead role, and has been performed countless times in schools, community theaters and professional productions.

When “Fiddler” was revived on Broadway in 1976, New York Times theater critic Clive Barnes described the show’s long-lasting appeal: “The book, the music, the lyrics, are absolutely perfect. There is not a song — and in this it is like the only other ‘perfect’ musical, ‘My Fair Lady’ — that you could consider being changed.”

Bock said he approached “Fiddler” like any other show, but he acknowledged the subtle influences of klezmer and other Jewish musical traditions that he learned in childhood. The music simply came to him, he said in 2002, “as I read Aleichem’s stories and remembered the lullabies and little melodies my grandmother would sing to me.”

One of the play’s most celebrated songs, “If I Were a Rich Man,” was originally titled “What a Life” and was meant to be sung by Tevye to his lame horse. But director Robbins didn’t want a horse on stage and asked Bock and Harnick to rewrite the song.

Together, the composers attended a Yiddish theater in New York and incorporated elements of the music they heard, using a chantlike staccato line of notes.

“When Jerry played me the music he wrote,” Harnick told National Public Radio interviewer Terry Gross in 2004, “he did the whole song in that kind of Hasidic chant. And we decided that it would be great fun to preserve part of the chant and not just to write wall-to-wall lyrics for the song.”

As Tevye, Mostel often improvised the nonsense syllables that give the song much of its exuberant flair:

“If I were a rich man,

Didle deedle didle didle didle deedle didle dum.

All day long, I’d biddy-biddy-bum,

If I were a wealthy man.”

But even when “Fiddler” is at its most lively, the music often has a melancholy undertone.

“I love Russian music, I love Romanian music,” Bock told NPR. “Minor is my major key.”

Jerrold Lewis Bock was born Nov. 23, 1928, in New Haven, Conn., and grew up in Queens, N.Y. As a boy, he could play advanced pieces on piano by ear and composed a musical in high school.

After studying at the University of Wisconsin, he moved back to New York in 1949 and wrote background music for the comic stage revues of Sid Caesar and Imogene Coca.

Bock collaborated on his first Broadway score in 1956 for the Sammy Davis Jr. showcase “Wonderful,” which contained the song “Too Close for Comfort,” now a pop-jazz standard.

Bock began working with Harnick in 1958 on “The Body Beautiful,” a boxing comedy that flopped. Then came “Fiorello!” about the life of New York Mayor Fiorello LaGuardia. The play made a star of actor Tom Bosley, who died Oct. 19.