The song was written in 1943 for the then-upcoming film "Meet Me in St. Louis", for which MGM had hired Martin and Blane to write several songs. Martin was vacationing in a house in the neighborhood of Southside in Birmingham, Alabama that his father Hugh Martin had designed for his mother as a honeymoon cottage, located just down the street from his birthplace, and which later became the home of Martin and his family in 1923. The song first appeared in a scene in which a family is distraught by the father's plans to move to New York City for a job promotion, leaving behind their beloved home in St. Louis, Missouri, just before the long-anticipated 1904 World's Fair begins. In a scene set on Christmas Eve, Judy Garland's character, Esther, sings the song to cheer up her despondent five-year-old sister, Tootie, played by Margaret O'Brien.