Marni Nixon, who anonymously provided the singing voice for three of the best-loved heroines in Hollywood musicals, dubbing Deborah Kerr as Anna in “The King and I,” Natalie Wood as Maria in “West Side Story” and Audrey Hepburn as Eliza Doolittle in “My Fair Lady,” died July 24 in New York City. She was 86.

Her death, from breast cancer, was confirmed by her daughters, Martha Carr and Melani Gold Friedman.

Sometimes described, much to her chagrin, as the “ghostess with the mostest,” Ms. Nixon was among the most sought-after movie singers of her era. She was hired for the uncredited if not wholly thankless job of providing vocals for stars whose singing ability did not match their acting skills.

Although the practice of dubbing songs was common throughout the movie industry, executives worried that if revealed, it might sour audiences on big-budget musicals featuring big Hollywood names. For that reason, vocalists such as Ms. Nixon were contractually obligated to secrecy.

Word about her contributions depended on the graciousness of certain actresses, as when Kerr publicly thanked the singer for helping on “The King and I” (1956). Three years earlier, she had assisted Marilyn Monroe with a single, breathy high-note passage in the tune “Diamonds Are a Girl’s Best Friend” in “Gentlemen Prefer Blondes.”

Marni Nixon in 1978. She provided the singing voice for some of the most famous characters in movies, including Anna in “The King and I” and Maria in “West Side Story.” (Chester Higgins Jr./New York Times)

A soprano of staggering versatility, she cultivated a repertoire that ranged from the classical works of Mozart to the avant-garde compositions of Webern. She performed in recitals at venues including New York’s Carnegie Hall and toured with Liberace and Victor Borge. But no performance reached more ears than her unseen roles in the movies.

Dubbing was demanding work that required the near-total suppression of ego. Ms. Nixon recalled being warned that if she ever spoke of her part in the movies, she would “never work in town again.”

The work required her to mimic, or as Ms. Nixon put it, to “extend” the actor’s voice. “That’s the whole secret of dubbing,” she told the New York Times in 1978. “You imagine how the actress would sing if she could sing and be sure to take from her what she wants to do dramatically.”

“The King and I,” which won an Oscar for the Rodgers and Hammerstein score with numbers such as “Getting to Know You” and “Shall We Dance,” was Ms. Nixon’s first major Hollywood assignment. Kerr played Anna Leonowens, a 19th-century British widow dispatched to Thailand as a teacher for the many children of a proud king portrayed by Yul Brynner.

Kerr, she said, worked tirelessly to mimic Ms. Nixon’s bearing as a singer, while Ms. Nixon sought to imitate the actress’s diction and presence.

With other singers, the relationship was more fraught. In “West Side Story” (1961), a modern take on Shakespeare’s “Romeo and Juliet” with music by Leonard Bernstein and lyrics by Stephen Sondheim, Wood played the female lead and was under the impression that Ms. Nixon was there for backup. When Wood learned that the filmmakers had dubbed her voice, Ms. Nixon recalled, the actress was infuriated.

Ms. Nixon said that after “West Side Story,” which won the Oscar for best picture and whose soundtrack became one of the most successful albums in history, the anonymity of her work began to gnaw at her.

“Then I saw how important my singing was to the picture,” she told the Times in 1967. “I was giving my talent, and somebody else was taking the credit. People were walking all over me.”

Bernstein agreed to give her a share of his royalties from the film, and she later advocated for vocalists to receive movie credits, along with the “assistant hairdressers and third assistant directors.”

She was uncredited for her role in “My Fair Lady” (1964), based on the musical with lyrics by Alan Jay Lerner and music by Frederick Loewe. Hepburn, she said, worked hard to master the score but concluded that the vocals were better entrusted to another singer.

“My Fair Lady” won the Oscar for best picture, but Julie Andrews claimed the award for best actress for her performance in a rival musical, “Mary Poppins.” As it turned out, Ms. Nixon had put her vocal touch on both films: Her voice could be heard in “Mary Poppins” in “Jolly Holiday,” the sequence in which Bert, played by Dick Van Dyke, dances with animated animals.

Ms. Nixon later appeared with Andrews on screen in “The Sound of Music” (1965) as Sister Sophia, a nun at the convent where Maria (Andrews) is a troublesome novice.

By the early 1980s, she decided that she had “had it” with dubbing. “It got so I’d lent my voice to so many others that I felt it no longer belonged to me,” she told the Times. “It was eerie, I had lost part of myself.”

Among Ms. Nixon’s most recent credited singing performances was as Grandmother Fa in the Disney animated film “Mulan” (1998); actress June Foray provided the character’s acting voice.

Margaret Nixon McEathron was born in Altadena, Calif., on Feb. 22, 1930. Marni, a combination of the first syllables of her first and middle names, was created for the benefit of a younger sibling who could not pronounced “Margaret.”

Ms. Nixon’s mother was the ringleader of the touring family ensemble that helped introduce Marni to show business. By her teens, she was widely known to industry insiders, and she got her first dubbing role in “The Secret Garden” (1949), in which she voiced child actress Margaret O’Brien singing a Hindu lullaby.

Her marriages to Ernest Gold, the Oscar-winning composer of the “Exodus” (1960) soundtrack, and Lajos Frederick “Fritz” Fenster ended in divorce. Her husband of 32 years, Albert Block, died in 2015.

A son from her first marriage, Andrew Gold, a singer and songwriter whose hits included the theme song of the sitcom “The Golden Girls,” died in 2011. Survivors include two daughters from her first marriage, Martha Carr of Los Angeles and Melani Gold Friedman of Tujunga, Calif.; three sisters; six grandchildren; and three great-grandchildren.

In her 2006 memoir, “I Could Have Sung All Night,” written with Stephen Cole, she wrote that she had at last found pleasure in the “secret job” that she had for so long resented. She had a place, long undisclosed, in some of the most popular films ever made.

“This ghost was alive,” she wrote. “I realized . . . that this was something that would outlive me. Something that would last.”