But her private life — she married a drama coach, David LeGrant, in 1952, had a son in 1959 and lived in a house with a garden on Long Island — was not the suburban idyll portrayed by the entertainment media. The couple were divorced in 1965. In the late ’60s and early ’70s, Ms. Cook drank more and worked less. In 1973, her teenage son went to live with his father.
By then, as she acknowledged in an interview with The New York Times Magazine in 2005, she was virtually unemployable, an alcoholic mired in depression. She went on eating binges and grew to 250 pounds.
“I was not some lady drunk,” she said. “I was a real nonfunctioning alcoholic. Dishes, always in the sink. The kitchen a mess. The bathroom a mess. Everything a mess.”
It might have been the end of her career. But in 1974 she befriended the pianist and composer Wally Harper, and they began a 30-year collaboration that would restore her voice and re-establish her professional credentials, albeit in a new direction: in nightclubs, cabarets and concert halls.
They started at a theater-district supper club. Luciano Pavarotti’s manager heard them and arranged a Carnegie Hall concert in 1975. Ms. Cook went on in a caftan, and the performance was a sensation — and the beginning of a long road back. Soon they had a contract with CBS Records, for which they recorded songs from the musical theater and other American standards.
Ms. Cook stopped drinking in 1977, and the crippling effects of depression subsided. But she continued to struggle with obesity. She lost some weight, but realized she would never return to the svelte 106-pound figure of the 1950s and resolved to continue her comeback whatever her weight.
“I decided that I had to try to be comfortable with my body as it was, because otherwise you just live in a closet, you don’t go out,” she told The Times.
Over the next few years, she sang at cabarets in New York and London. Another Carnegie Hall concert in 1980 revealed that she had found a new, more mature identity as a singer. Paying less heed to the technical virtuosity that had thrilled audiences in big Broadway theaters, she now emphasized phrasing and styling to project a song’s emotions in smaller, more intimate settings.
The effect was striking. She had made no secret of her personal problems. But character and hard-won experience seemed to suffuse her songs, and it connected with audiences and critics. The reviewers took up a refrain, with phrases like “simple honesty,” “simplicity and directness” and “straightforward and declamatory.”
Looking back after Ms. Cook’s 85th-birthday concert at Carnegie Hall in 2012, Anthony Tommasini, in an assessment in The Times, wrote, “Long ago Ms. Cook figured out what really matters in singing: to put lyrics across as if she were confiding in you, to bend melodic phrases to expressive ends, to inflect her sound with heartache, happiness, sass, bitterness or whatever the moment calls for.”
Barbara Cook was born in Atlanta on Oct. 25, 1927, the older of two daughters of Charles Cook, a traveling salesman, and the former Nell Harwell, a telephone operator for Southern Bell.
Growing up, Barbara blamed herself for two crushing events in her childhood. Her 18-month-old sister, Patricia, died after contracting pneumonia and whooping cough at a time when Barbara, 3, had whooping cough. And in the stressful time that ensued, her parents divorced.
Barbara sang at Elks and U.S.O. clubs, danced at amateur-night performances in theaters and later got a job as a chorus girl and sang on the radio. She graduated from Girls’ High School in 1945, and in 1948 moved to New York. She worked as a typist and file clerk, auditioned for musical parts and had her first singing engagement in a Boston nightclub in 1950.
She made her Broadway musical debut in 1951 in “Flahooley.” Despite lyrics by E. Y. Harburg and an eclectic cast that included the singer Yma Sumac and the comedian Irwin Corey, it closed after 40 performances. But Brooks Atkinson, in his review for The Times, called Ms. Cook “especially winning.”
In 1953 she appeared in a revival of “Oklahoma!,” singing a spirited “I Cain’t Say No” and “All er Nothin’.” In 1955 she played an Amish girl in the Broadway hit “Plain and Fancy,” and a year later she enchanted audiences as Cunegonde in “Candide.”
In 1957, she starred in what became one of Broadway’s biggest hits, “The Music Man,” as Marian Paroo, the prim librarian of River City, Iowa, who charms and reforms the fast-talking, heart-of-gold con man Harold Hill, played by Robert Preston. Ms. Cook, Mr. Preston and the show all won Tonys. It ran for more than three years, although Ms. Cook withdrew in 1959 to give birth to her son.
Her comeback in nightclubs and concert halls, with Mr. Harper as pianist and arranger, led to her reincarnation as an interpreter of standards and musical theater songs, particularly those of Stephen Sondheim. In 1985, she appeared with the New York Philharmonic in a concert version of Mr. Sondheim’s “Follies.”
Ms. Cook recorded dozens of albums, toured America and gave concerts all over the world. She sang at the White House for Presidents Jimmy Carter, Ronald Reagan, George Bush and Bill Clinton. She won a 1987 Drama Desk Award for a solo Broadway show, “A Concert for the Theatre.” For her 70th birthday, in 1997, she sang at the Albert Hall in London, and in 2001 she performed “Barbara Cook Sings Mostly Sondheim” at Carnegie Hall, to rave reviews.
In 2005, a year after Mr. Harper’s death, she recorded “Tribute,” an album dedicated to him. In 2006 she became the first female pop singer to give a full concert at the Metropolitan Opera since its founding in 1883, although she had made her Met debut in 2003 as a special guest soloist. She gave two sold-out concerts with the New York Philharmonic Orchestra at Lincoln Center in 2007.
Teaching master classes at the Juilliard School in recent years, Ms. Cook often waved off her students’ preoccupation with vocal perfection, pushing them instead to get at the pain and joy beneath the notes.
“What is this song about?” she demanded of one bewildered class.
A student with a lovely voice tried singing “Can’t Help Lovin’ Dat Man,” from “Show Boat.”
But Ms. Cook cut her off, and rendered a hard judgment: “You do not have the life experience to really, really sing this song.”
Correction: August 8, 2017
An earlier version of this obituary, using information from Ms. Cook’s son, misstated when she died. It was early Tuesday, not Monday.