Martin, who collaborated in an unusual partnership with Ralph Blane on Broadway and in film, died of natural causes Friday at home in Encinitas, north of San Diego, said his niece Suzanne Hanners.
But the melancholy Christmas lyrics Garland sang in the film were not the ones Martin originally wrote. His first lines were even darker.
"Have yourself a merry little Christmas, it may be your last," went the original. "Next year we may all be living in the past," followed by "Faithful friends who were dear to us, will be near to us no more."
A studio executive suggested lightening the lyrics, saying, "It's OK for it to be bittersweet and nostalgic, but it shouldn't be a dirge."
So Martin went back to work, revising the lines:
"Have yourself a merry little Christmas, let your heart be light; next year all our troubles will be out of sight."
Released during World War II, the film and its signature songs struck a chord with moviegoers.
"The audience comes to care deeply about these people and their story," Miles Kreuger, president of the Los Angeles-based Institute of the American Musical, said in an interview Saturday. "The score very subtly and successfully captures the essence of what these characters are thinking and feeling, so the audience is immediately drawn to the integrity of the songs....
"Now years later ['Have Yourself a Merry Little Christmas'] still is so emotionally sensitive and so valid that people are deeply moved by it. It's a masterpiece."
Then, in 1957, Frank Sinatra was making recordings for a holiday album to be called "A Jolly Christmas" and asked Martin to "jolly up" his song.
So to substitute for "Until then we'll have to muddle through somehow," he came up with "Hang a shining star upon the highest bough."
Sinatra's version helped lift "Have Yourself a Merry Little Christmas" into the ranks of cherished holidays classics. It has since been recorded by hundreds of performers, including Bing Crosby, Tony Bennett, Diana Krall, James Taylor and the Pretenders.
Although Martin and Blane shared writing credits in the 1940s, they worked independently.
"Ralph and I both wrote music, and we both wrote lyrics," Martin once explained. "Almost always, each of us wrote songs unassisted by the other and simply pooled our work."
In his 2010 autobiography, "Hugh Martin, The Boy Next Door," he maintained that he wrote the songs for "Meet Me in St. Louis" on his own.
For another of Garland's signature films, 1954's "A Star Is Born," Martin served as vocal director and arranger. He also accompanied Garland on piano during her solo show at New York's Palace Theatre in 1951.
Martin and Blane met in the late 1930s as performers singing in Broadway musicals. Martin was making a name for himself as a vocal arranger for Broadway shows when the duo got the chance to write words and music for "Best Foot Forward" in 1941.
That brought them to the attention of Metro Goldwyn Mayer, which signed them to write for the movies. After finishing "Meet Me in St. Louis," Martin served in the Army, performing for troops in Europe.
He returned to Hollywood after the war and received another Oscar nomination along with Blane and Roger Edens for the song "Pass That Peace Pipe" from 1947's "Good News."
Martin continued to write and arrange for both film and stage productions, including the Tony-nominated "High Spirits" (1964).
He and Blane teamed up again for a 1989 Broadway revival of "Meet Me in St. Louis," writing several new songs. Blane died in 1995.
Martin was born Aug. 11, 1914, in Birmingham, Ala., and learned to play piano at age 5. He attended Birmingham Southern College before moving to New York.
He never married and retired to Encinitas in the 1970s.
Martin is survived by his brother, Gordon, of Birmingham; as well as nieces and nephews, and his longtime manager and caretaker, Elaine Harrison of Encinitas.