Besides “A Chorus Line” — one of the most enduring stage musicals of all time — Mr. Hamlisch’s movie portfolio included the inspired revival of Scott Joplin’s jaunty ragtime music for “The Sting,” the sweepingly romantic theme for “The Way We Were” and the sensuous ballad“Nobody Does It Better” for the James Bond film “The Spy Who Loved Me.” He also wrote music for two early Woody Allen comedies and the score for the Holocaust drama “Sophie’s Choice.”
Mr. Hamlisch, who died Monday at 68 in Los Angeles of undisclosed causes, was one of the most ubiquitous show-business personalities of his generation. He toured the country playing the piano and warbling for decades, including as a musical accompanist and straight man for comedian Groucho Marx in the early 1970s.
He was principal pops conductor at a half-dozen symphony orchestras, including the National Symphony Orchestra in Washington from 2000 to 2011 and again as recently as last month for a concert date.
Mr. Hamlisch was the somber-looking, bespectacled pinup of a nerdy girl’s dreams, sending Gilda Radner as her “Saturday Night Live” character Lisa Loopner into spasms of awkward ecstasy.
Mr. Hamlisch could get a little cocky. He created a musical high-wire act called “rent-a-composer,” in which he composed instant songs to titles called out by audience members. “I can make a song up about anything: garbage, the weather, things in the news,” he once said.
He could afford to be a little cocky. His awards haul included the Pulitzer Prize, the Oscar, the Tony, the Emmy and the Grammy. He achieved an Academy Awards hat trick in 1974, winning in three music categories — score adaptation (“The Sting”), best original dramatic score (“The Way We Were”) and best song (“The Way We Were,” with the lyricists Alan and Marilyn Bergman).
On his third trip to the podium, Mr. Hamlisch quipped to the Oscar-night crowd, “I think we can now talk to each other as friends.”
It was the sort of self-effacing gab that made him a frequent talk show guest. Along with John Williams, Mr. Hamlisch was one of the few composers who enjoyed a public profile that made him instantly recognizable to much of the general public.
His music for “The Sting” — helped by a first-rate movie starring Paul Newman and Robert Redford as Depression-era con men who try to cheat a gangster — was often credited with reviving Joplin from near-obscurity. Mr. Hamlisch’s recordings of Joplin songs, including “The Entertainer,” sold millions of copies.
On first hearing, Joplin may have sounded anachronistic on “The Sting” soundtrack. His turn-of-the-century rags were no one’s idea of contemporary music by the 1930s — the setting for the film. But it established a playful mood essential for director George Roy Hill’s romp.
“That music kept the film from being a gangster movie,” Mr. Hamlisch told the Portland Oregonian in 1988. “It set a light tone from the very start, and it was the only thing that did, if you recall. The sets were dark, the photography was dark. It was the Depression.
“But that great, light, lively Joplin music lets you know right off that the film has humor, that you’re going to have fun,” he added. “Later music would have been bad — swing or something from the ’40s or ’50s. But Joplin’s music is perfect for the film. I can’t imagine it without it.”
Much of Mr. Hamlisch’s legacy rests on “A Chorus Line,” which ran on Broadway from 1975 to 1990 and explored the humanity behind an outwardly anonymous chorus line. The overall conception belonged to the late Michael Bennett, who recruited Mr. Hamlisch after deciding that his original plan for “an opera-ballet” felt too heavy.
Mr. Hamlisch wrote the music to Edward Kleban’s lyrics for such songs as the high-kicking showstopper “One” and the ballad “What I Did For Love.”
The production won the 1976 Pulitzer Prize for drama. It swept the Tony Awards, with Mr. Hamlisch and Kleban sharing honors for best original score. “A Chorus Line” became one of Broadway’s longest-running musicals and drew an endless stream of superlatives from reviewers.
Along with his accumulated movie work, “A Chorus Line”propelled Mr. Hamlisch to the front rank of popular songwriters. In an interview, Jon Burlingame, a historian of film composition, described Mr. Hamlisch as “a tunesmith par excellence.”
Mr. Hamlisch’s reputation won him prime assignments, including one to write the theme to “The Spy Who Loved Me” (1977) with lyricist Carole Bayer Sager. Their song “Nobody Does it Better” was a hit for Carly Simon and brought Mr. Hamlisch and Sager an Oscar nomination for Best Original Score and Best Original Song.
Mr. Hamlisch’s work on “Ice Castles” (1978), “Same Time, Next Year” (1978), “Sophie’s Choice” (1982), “Shirley Valentine” (1989), “The Mirror Has Two Faces” (1996) and the critically derided 1985 film adaptation of “A Chorus Line” brought Mr. Hamlisch even more nominations for his composition skills.
Meanwhile, he remained a stalwart of the concert scene, served as a music director for Barbra Streisand and had a hand in various musical theater productions.
He suffered Broadway flops in 1986 with “Smile,” based on a 1975 movie of the same name that satirizes beauty pageants, and in 1993 with his musical adaptation of Neil Simon’s comedy “The Goodbye Girl.” Mr. Hamlisch’s “Jean Seberg,” a musical stage biography of the actress, played in London in 1983 but never appeared on Broadway. He fared better commercially on Broadway with Simon’s romantic comedy “They’re Playing Our Song” (1979), which was based in part on Mr. Hamlisch’s fitful romantic relationship with Sager (who contributed lyrics). Shortly before his death, Mr. Hamlisch composed the score for a musical stage version of the Jerry Lewis film “The Nutty Professor.”
Marvin Frederick Hamlisch was born June 2, 1944, in New York City and grew up on Manhattan’s Upper West Side. His father, Max, was an Austrian-born accordionist who encouraged his son’s musical proclivities but also urged his ambitions to a perhaps unhealthy degree.
In his 1992 memoir, “The Way I Was,” Mr. Hamlisch imagined his father “looking down at me from some celestial plane and saying, ‘What’s the matter, Marvin? By the time Gershwin was your age, he was dead. And he’d written a concerto. Where’s your concerto, Marvin?’ ”
He graduated from Queens College with a bachelor’s degree in music in 1967. At the time, he was already a show business veteran whose “Sunshine, Lollipops and Rainbows,” composed at a summer camp, became a pop hit for Lesley Gore and was featured in the 1965 film “Ski Party.”
Mr. Hamlisch was in demand as a Broadway musical arranger and rehearsal pianist. A pivotal moment in his career was a job playing piano for a party hosted by the film producer Sam Spiegel.
Mr. Hamlisch learned that Spiegel needed someone to write the theme music for his latest project, a version of the John Cheever short story “The Swimmer.” After three days trying out ideas, Mr. Hamlisch won over Spiegel. The film, released in 1968 and starring Burt Lancaster as a man living a suburban illusion, was a commercial flop but established Mr. Hamlisch as a promising talent.
He went on to increasingly more prestigious assignments including the Woody Allen comedies “Take the Money and Run” (1969) and “Bananas” (1971); “Save the Tiger” (1973) with Jack Lemmon; and “Ordinary People” (1980), directed by Robert Redford.
Mr. Hamlisch earned his first Oscar nomination for the song “Life Is What You Make It” — with lyrics by Johnny Mercer — from the 1971 film “Kotch.” He shared a Grammy Award with the Bergmans for the album of the score to “The Way We Were.” Mr. Hamlisch also composed the theme for the ABC television program “Good Morning America” and, with Sager, gave Aretha Franklin a top rhythm-and-blues hit with the song “Break It to Me Gently” in 1977.
In 1989, Mr. Hamlisch married Terre Blair, who survives him. No other information about survivors was released by his representatives.
In recent years, Mr. Hamlisch wrote music for the Steven Soderbergh drama “The Informant!” (2009) and had been commissioned to write a score for Soderbergh’s “Behind the Candelabra,” a planned film about the entertainer Liberace. Mr. Hamlisch spoke about the increasingly rare opportunity to compose for movies aimed at a mature audience who could appreciate a story told through music.
“Let’s face it,” he told the Hollywood Reporter in 2009, “I’m not going to do ‘Transformers 14.’ ”