He released more than 50 albums but had his greatest commercial success with “Compared to What,” a recording that came together at the last minute in 1969.Les McCann, a jazz pianist and vocalist who was an early progenitor of the bluesy, crowd-pleasing style that came to be known as soul jazz, and who, although he released more than 50 albums, was best known for a happenstance hit from 1969, died on Friday in Los Angeles. He was 88.His death, at a hospital where he had been admitted with pneumonia, was confirmed on Monday by Alan Abrahams, his longtime manager and a producer of several of his albums. Mr. McCann had lived for the past four years at a skilled nursing facility in the Van Nuys neighborhood of Los Angeles.Mr. McCann’s earthy, uplifting approach to music was a product of his upbringing in a churchgoing family. As he came to emphasize his singing more and play electric keyboards, his albums, released from 1960 to 2018, influenced funk and R&B artists and became a rich vein for hip-hop artists to mine.His greatest commercial success, though, came purely by chance, in June 1969 at the Montreux Jazz Festival in Switzerland.Already a recording veteran by then, with albums on Pacific Jazz, Limelight and, most recently, Atlantic, Mr. McCann was appearing at the festival for the first time. After he and the tenor saxophonist Eddie Harris, also an Atlantic artist, played separate sets, they gave an unscheduled performance together, with Mr. Harris as well as the expatriate trumpeter Benny Bailey joining Mr. McCann’s trio.Neither had played with Mr. McCann before, and there was no time for rehearsal. But the performance was to be recorded and filmed for broadcast.Despite the pressure, or perhaps because of it, as Mr. McCann recalled in the liner notes for the 1996 CD reissue of the concert album, which was released in 1969 as “Swiss Movement,” “Just before we went onstage, and for the first time in my life, I smoked some hash.”When he got to the bandstand, he wrote, “I didn’t know where the hell I was. I was totally disoriented. The other guys said, ‘OK, play, man!’ Somehow I got myself together, and after that, everything just took off.”The highlight of the concert was Eugene McDaniels’s protest song “Compared to What.” Stretching past eight minutes and featuring Mr. McCann’s churchy vocals, “Compared to What” would be released as a single and peak at No. 35 on the Billboard R&B chart. “Swiss Movement” was nominated for a Grammy Award and went on to sell a half-million copies.Mr. McCann and Mr. Harris reconvened in 1971 for the Atlantic studio album “Second Movement.” They also returned to Montreux for the 1988 festival, where they performed an obligatory reprise of “Compared to What.”Leslie Coleman McCann was born on Sept. 23, 1935, in Lexington, Ky., to James and Anna McCann. His father was a water maintenance engineer.His family was a musical one; he, his four younger brothers and his sister all sang in the Shiloh Baptist Church choir. Mr. McCann began playing piano at age 3 and a few years later had a music teacher, who charged 35 cents a lesson. (Those lessons did not last long: She died only six weeks after he began studying with her.) While attending Dunbar High School in Lexington, he played drums and sousaphone in the marching band.He left Kentucky at 17 when he enlisted in the Navy and was posted to the San Francisco area.Les McCann performing at the Newport Jazz Festival in 1974. He had been performing in clubs in Los Angeles when he was first offered a record contract.Tom Copi/Michael Ochs Archive, via Getty ImagesDuring his time in the Navy, he sang on “The Ed Sullivan Show” after winning a talent contest. On his nights off, he would spend time at the Black Hawk, a San Francisco jazz nightclub.After leaving the Navy, Mr. McCann moved to Los Angeles, where he studied music and journalism at Los Angeles City College and hosted a Monday night jam session at the Hillcrest Club. It was during that time that he first connected with Mr. McDaniels.In a 2017 interview for the magazine Oxford American, Mr. McCann was asked about Mr. McDaniels’s composition “Compared to What.” “When I heard him,” he said, “I hired him in my band — one of the best singers I’ve ever heard. And I found out he was also a writer. We stayed in touch for years after that, and he would always send me songs. I can’t tell you how many songs he sent me, but that one stuck with me.”Mr. McCann was performing in Los Angeles clubs when a representative of Pacific Jazz Records heard him and asked if he had a record contract. When told no, the representative pulled one from his pocket and offered it to him.Mr. McCann recorded more than a dozen albums for the label from 1960 to 1964, usually leading a trio under the businesslike moniker Les McCann Ltd., but sometimes adding guest horns or orchestral accompaniment and sometimes collaborating with the guitarist Joe Pass. He also took part in Pacific Jazz sessions led by the saxophonist Teddy Edwards, the Jazz Crusaders and others. Les McCann Ltd. backed the singer Lou Rawls on his debut album, “Stormy Monday,” released by Capitol in 1962.Mr. McCann then moved to Limelight, a subsidiary of Mercury Records run by Quincy Jones, for which he made six albums from 1964 to 1966. He signed with Atlantic in 1968; on his first album for the label, “Much Les,” he was accompanied by a string section.He would make 11 albums for Atlantic. On two of them, “Invitation to Openness” (1971) and “Layers” (1972), he played a host of keyboards and synthesizers, an avenue he had been inspired to explore after hearing the keyboardist Joe Zawinul’s work with Miles Davis. Those albums have been cited as seminal in popularizing electric keyboards.Later in his Atlantic years, Mr. McCann was featured more as a singer in a slicker, more pop-oriented context. This continued through the 1970s and ’80s on albums for the Impulse!, A&M and Jam labels. But he also remained committed to the piano. In 1989, when he was a guest on the NPR show “Piano Jazz,“ hosted by his fellow pianist Marian McPartland, it was as both a singer and a player. The two closed the broadcast with a duet on “Compared to What.”Mr. McCann had returned to emphasizing his piano playing by 1994, when he released “On the Soul Side,” the first of three albums for the MusicMasters label, which reunited him with Eddie Harris and Lou Rawls. But a stroke later that year forced him to once again focus on singing, which he did through the end of the decade.He later recovered fully and resumed recording. He released albums on a German label in 2002 and on a Japanese label two years later. His last recording was the holiday-themed “A Time Les Christmas,” which he released himself in 2018.In December, Resonance Records released the archival album “Les McCann — Never a Dull Moment! Live From Coast to Coast (1966-1967),” comprising concert recordings from Seattle and New York.Information about his survivors was not immediately available.Mr. McCann’s music has been sampled by nearly 300 hip-hop artists, including Eric B. & Rakim, A Tribe Called Quest, Cypress Hill, Nas, De La Soul, Snoop Dogg, the Notorious B.I.G. and Sean Combs.Mr. McCann performing at the 40th Montreux Jazz Festival in 2006. He also painted and was a photographer.Martial Trezzini/European Pressphoto AgencyIn 1975, Mr. McCann became the first artist in residence at Harvard University’s Learning From Performers program. He was also a devoted painter and photographer of jazz culture and Black history, and his images have been included with some of his albums. His work was collected in 2015 in the book “Invitation to Openness: The Jazz & Soul Photography of Les McCann 1960-1980.”In an interview for the preface to that book, Mr. McCann was asked how he had achieved intimacy with his photographic subjects. He responded: “I trust my intuition, you see,” adding, “I’m better off when I just do what I do on the piano: play.”Rebecca Carballo More