Ralph Sharon at his piano beneath a portrait of him painted by Tony Bennett, with whom he performed for more than 40 years. (CARMEL ZUCKER/The Boulder Daily Camera)

Ralph Sharon, a British-born jazz pianist who spent four decades as Tony Bennett’s accompanist and who discovered the singer’s signature tune, “I Left My Heart in San Francisco,” died March 31 at his home in Boulder, Colo. He was 91.

Mr. Sharon’s son, Bo Sharon, confirmed the death, but the cause was not determined.

After beginning his musical career in London, Mr. Sharon came to the United States in 1953 and worked with top musicians, including clarinetist Tony Scott and singers Chris Connor and Johnny Hartman. He had never heard of Bennett until the singer called him for an audition in 1957.

“He sang a few things and I played a few things,” Mr. Sharon said in a 2009 interview with the Boulder Daily Camera. “I thought, ‘This guy sounds pretty good.’ At the end, he said, ‘How’d you like to come with me?’ I said, ‘Come with you where?’ He said, ‘Everywhere.’ ”

Mr. Sharon was Bennett’s pianist during the singer’s heyday in the 1960s and helped guide his musical comeback in the 1990s, when Bennett found unexpected popularity with a new generation of fans. The singer and pianist toured the world together, and Mr. Sharon was the musical director for all of the 10 Grammy Awards that Bennett won between 1962 and 2002.

For years, Mr. Sharon was an unobtrusive onstage presence, hunched over the piano as he provided the buoyant grace behind Bennett’s singing.

“No one understands me more than he does, and we’ve become as close as brothers,” Bennett wrote in “The Good Life,” his 1998 autobiography. “Ralph is my idea of the perfect accompanist.”

Early in their collaboration, Mr. Sharon steered Bennett away from the pop music he had been singing and more toward jazz and standards. In 1957, he coordinated what remains one of Bennett’s most daring and original albums, “The Beat of My Heart,” which featured drummers Art Blakey, Jo Jones and Chico Hamilton and other jazz musicians.

“He loved jazz, loved to listen to it,” Mr. Sharon told the Chicago Tribune in 1992. “So, if I may say so, I was like the missing ingredient for him. I could bring out the jazz element that already was there in the background.”

In 1961, they recorded one of Bennett’s most intimate albums, “Tony Sings for Two,” in which the singer’s voice is accompanied only by Mr. Sharon’s lithe, swinging piano. Later that year, Mr. Sharon introduced Bennett to “I Left My Heart in San Francisco,” a then-unknown song written by George Cory and Douglass Cross.

Bennett’s first public performance of the tune came at San Francisco’s Fairmont Hotel weeks before he recorded it in January 1962. It won the Grammy Award for Record of the Year.

“If not for Ralph,” Bennett told the Tribune, “I wouldn’t have that song, which has made me welcome all around the world.”

In the late 1960s, Mr. Sharon moved from New York to Los Angeles and worked behind singers Rosemary Clooney, Nancy Wilson and Robert Goulet. He reunited with Bennett in 1979, when the singer began to launch his comeback.

Mr. Sharon was the pianist and principal arranger on many of Bennett’s later hit records, including “Perfectly Frank” (1992), which earned Bennett his first Grammy Award in 30 years, and “Steppin’ Out” (1993), which won a Grammy for Best Traditional Pop Vocal.

In 1994, Mr. Sharon’s attentive, effortless-sounding piano was prominently featured when Bennett appeared on an episode of MTV’s “Unplugged” series. The resulting album, MTV Unplugged,” won the Grammy for Album of the Year.

“When I look back and review my recordings,” Bennett told the Hartford Courant in 2005, “I see that the best singing I do is when there’s a great jazz artist around, like Stan Getz or Bill Evans, or when Ralph Sharon was playing piano for me.”

Ralph Simon Sharon was born Sept. 17, 1923, in London. His mother played piano for silent movies, but Mr. Sharon showed little interest in music until he discovered American jazz, particularly the piano performances of Fats Waller and Art Tatum.

He began performing in his teens and later joined top British bands led by Ted Heath and Frank Weir. After coming to the United States, Mr. Sharon would win renown as an accompanist to singers, but he continued to perform in jazz settings and recorded more than 30 albums as a leader of small jazz groups.

Mr. Sharon retired as Bennett’s musical director in 2002 and settled in Colorado, where he performed in jazz clubs and hotel lounges until as recently as three months ago.

Survivors include his wife of 41 years, Linda Noone Sharon, and their son, Bo Sharon, both of Boulder; and two grandsons.

During his years with Bennett, Mr. Sharon selected many of the singer’s songs, and the two worked out the arrangements together at the piano. Each of them knew the music and lyrics to thousands of tunes, but none could match the unexpected success of “I Left My Heart in San Francisco.”

In a 1988 interview with British jazz writer Les Tomkins, Mr. Sharon recalled that the songwriters, Cory and Cross, gave him the sheet music in about 1960, but “I put it away in a drawer and forgot all about it.”

When he and Bennett were about to embark on a nationwide tour in 1961, Mr. Sharon said, “I was looking through a drawer for some shirts; I pulled this sheet out, and it said: ‘I Left My Heart in San Francisco.’ So I thought, ‘Well, we’re going to San Francisco — I’ll just put this in my case.’ ”

He showed the song to Bennett one day at a hotel bar in Hot Springs, Ark. After they played it once, the bartender said, “If you guys record that song, I’ll buy the first copy.”

Over the years, as the song grew in popularity, audiences began to demand it every time Bennett took the stage.

“It’s Tony’s signature tune now,” Mr. Sharon said. “Yet it was a complete accident — if I hadn’t looked for that shirt in that drawer, it would never have happened.”