Hamlisch died Aug. 6 in Los Angeles after a short illness. He was 68.
Other guests included ex-Yankees manager Joe Torre, Kelli O'Hara, Ann-Margret, Raul Esparza, Robert Klein, Brian Stokes Mitchell, Leslie Uggams, Richard Gere, Tony Danza, Kathie Lee Gifford, and Diane Sawyer and her husband, Mike Nichols, the film and stage director. Idina Menzel sang "At the Ballet."
"Genius is rare enough, but a good-hearted genius is rarer still. A good-hearted, humble and hilarious genius is almost unheard of," Clinton said.
Hamlisch -- at age 7, the youngest person ever accepted by The Juilliard School -- composed or arranged hundreds of scores for musicals and movies. He became one of the most decorated artists in history, winning three Oscars, four Emmys, four Grammys, a Tony, a Pulitzer and two Golden Globes.
His funeral was held at Congregation Emanu-El, a prominent Manhattan synagogue where legendary songwriter George Gershwin's funeral was held in 1937.
Exclusive subscription offer
Newsday covers the stories that matter most to Long Islanders. We dig deep to uncover the facts, hold the powerful in check and keep a watchful eye on Long Island.
Your digital subscription, starting at $1, supports local journalism vital to the community.SUBSCRIBE NOW
Speakers described a friend always willing to help a good cause, who was a bashful philanthropist and a devoted Yankees fan who would ask for the latest scores before stepping onstage.
A choir that included fellow composers, lyricists and musicians such as Lucie Arnaz, Rupert Holmes and Sheldon Harnick sang "The Way We Were" and "What I Did for Love."
Statements of mourning were read from President Barack Obama and former first lady Nancy Reagan.
Hamlisch is survived by his wife of 26 years, Terre, who took the podium and shared memories of a man whose "life force was huge."
He was likely to cheer her up in the morning by jumping on top of the bed and performing an entire musical -- complete with music, lyrics, all the parts and the dancing chorus -- "to the disbelief of myself and our dogs."
"Marvin taught me how to live life with gusto and magic," she said. "He would order every dessert on the menu so everyone could taste everything and miss nothing in life."