NEW YORK — Nora Ephron, the essayist, author and filmmaker who challenged and thrived in the male-dominated worlds of movies and journalism and was loved, respected and feared for her wit, died on Tuesday of leukemia. She was 71.

Ephron’s son, Jacob Bernstein, confirmed her death. Her book publisher Alfred A. Knopf also confirmed it in a statement.

Born into a family of screenwriters, she was a top journalist in her 20s and 30s, then a best-selling author and successful director. Ephron was among the most quotable and influential writers of her generation. She wrote and directed such favorites as “Julie & Julia” and “Sleepless in Seattle,” and her books included the novel “Heartburn,” a brutal roman a clef about her marriage to Washington Post reporter Carl Bernstein; and the popular essay collections “I Feel Bad About My Neck” and “I Remember Nothing.”

She was tough on others – Bernstein’s marital transgressions were immortalized by the horndog spouse in “Heartburn,” a man “capable of having sex with a Venetian blind” – and relentless about herself. She wrote openly about her difficult childhood, her failed relationships, her doubts about her physical appearance and the hated intrusion of age.

“We all look good for our age. Except for our necks,” she wrote in the title piece from “I Feel Bad About My Neck,” published in 2006. “Oh, the necks. There are chicken necks. There are turkey gobbler necks. There are elephant necks. There are necks with wattles and necks with creases that are on the verge of becoming wattles. … According to my dermatologist, the neck starts to go at 43 and that’s that.”

Even within the smart-talking axis of New York-Washington-Los Angeles, no one bettered Ephron, slender and dark-haired and armed with a killer smile. Friends from Mike Nichols and Meryl Streep to Calvin Trillin and Pete Hamill adored her for her wisdom, her loyalty and turns of phrase.

As a screenwriter, Ephron was nominated three times for Academy Awards, for “Silkwood,” ”When Harry Met Sally …” and “Sleepless in Seattle,” and was the rare woman to write, direct and produce Hollywood movies. Meg Ryan was among the many actresses who said they loved working with Ephron because she understood them so much better than did her male peers.

The eldest of four children, Ephron was born in New York to screenwriters Harry and Phoebe Ephron, who moved to Beverly Hills, Calif., when she was 4 years old. Words, words, words were the air she breathed. Regular visitors included “Casablanca” co-writer Julius J. Epstein, “Sunset Boulevard” collaborator Charles Brackett, and the team of Albert Hackett and Frances Goodrich, who worked on “The Thin Man” and “It’s a Wonderful Life.”

Everyone was in movies, “the business.”

“People who were not in the business were known as civilians,” Ephron wrote in “I Remember Nothing.”

If the best humor is born out of sadness, then Ephron was destined for comedy. She was 15, she recalled, when her mother became an alcoholic, finishing off a bottle of scotch a night. Her father, too, was a heavy drinker, “sloppy, sentimental,” although “somehow his alcoholism was more benign.”

Determined by high school to be a journalist, Ephron graduated from the single-sex Wellesley College in 1962, moved to New York and started out as a “mail girl” and fact checker at Newsweek. A newspaper strike at the end of the year gave her a chance. Victor Navasky, the future editor of The Nation, was then running a satirical magazine called the Monacle. He was working on a parody of the New York Post, “The New York Pest,” and asked Ephron for a spoof of Post columnist Leonard Lyons.

She succeeded so well that the newspaper’s publisher, Dorothy Schiff, reasoned that anyone who could make fun of the Post could also write for it. Ephron was asked to try out as a reporter. Within a week, she had a permanent job and remained there five years.

Ephron began writing for Esquire and The New York Times and developed a national following as a throwback to the prime of Dorothy Parker and S.J. Perelman and a worthy peer of such “new” and hip journalists as Gay Talese and Tom Wolfe. She covered political conventions, the feminist movement and Wellesley, which she labeled a factory for “docile” women. Part of her gift was her fresh takes on such traditional subjects for women as food and fashion, like in the essay “The Food Establishment: Life in the Land of the Rising Souffle (Or Is It the Rising Meringue).”

“The typical member of the Food Establishment,” she wrote, “is given to telling you, apropos of nothing, how many souffles he has been known to make in a short period of time. … He gossips a good deal about his colleagues, about what they are cooking, writing, and eating; and whom they are talking to, about everything, in fact, except the one thing everyone else in the universe gossips about – who is sleeping with whom.”

By the 1970s, she had met and married Carl Bernstein, who teamed with fellow Washington Post reporter Bob Woodward on prize-winning coverage of the Watergate scandal that brought down President Nixon. They married in 1976, and had two children, but love soon turned to hate – and matured into art. Ephron was pregnant with the second child when she learned Bernstein was having an affair, a betrayal that had its rewards, once she stopped crying.

She wrote “Heartburn,” later a film starring Streep and Jack Nicholson and directed by Nichols, with whom she collaborated often. The book was so close to her life that Bernstein threatened to sue. Decades later, the memory of the book’s birth was easily summoned.

“Yes, totally, completely, absolutely, sitting at the legendary and long-gone Smith Corona electric typewriter that I once had,” she told The Associated Press in 2010. “I was working on a screenplay and wrote the first 10 pages of a novel, and I knew the title, knew there were going to be recipes in it. This I remember, exactly where I was, working and knowing, ‘Oh, I see, enough time has passed that I’m ready to do this.’ “

Another perk from her time with Bernstein: She sussed out that “Deep Throat,” the unnamed and unknown Watergate source, was in fact FBI official Mark Felt. She would allege that she told countless people about Felt, who did not acknowledge his role until years later.

Her screenwriting credits included “Heartburn,” the nuclear power drama “Silkwood” and the romantic comedy “When Harry Met Sally …” She twice directed the team of Meg Ryan and Tom Hanks, in “Sleepless in Seattle” and “You’ve Got Mail,” and also worked with John Travolta (in the fantasy “Michael”), Steve Martin (“Mixed Nuts”) and Nicole Kidman (“Bewitched”).

Ephron had a great nose for nonsense, but was enough a child of Hollywood to fall, and fall hard, for a happy ending. “Sleepless in Seattle,” in which Ryan and Hanks play long-distance admirers who meet at film’s end, was itself a tribute to how movies might tell us how to live. “Sleepless” was not only a remake of the sentimental “An Affair to Remember.” Ryan and her best pal, played by Rosie O’Donnell, are seen watching “Affair to Remember,” which inspires Ryan to suggest to Hanks that they meet on top of the Empire State Building, on Valentine’s Day.

Ephron was married three times: to Dan Greenberg, Bernstein and, quite happily, to Nicholas Pileggi, who survives her and whose book “Wiseguys” was adapted into the Martin Scorsese film of the same name. Sisters Delia, Amy and Hallie Ephron also are writers and Nora and Delia collaborated on the screenplay for “This Is My Life.”

In her essay “The O Word,” Nora Ephron anticipated growing too old to make jokes about her age. She would be “really old,” beyond sex in a hotel room, or even a frozen custard at Shake Shack. It would be nice if she believed in a higher being, but the phrase “everything happens for a reason” is a sermon that only annoys her.

Ephron wrote of summers in the Hamptons on Long Island when her children were little, of fireworks on the Fourth of July and picnics on the beach. She loved the sound of geese in mid-July – “one of the things that made the summers out there so magical.” As she aged, the geese reminded her that summer will end, and so will everything else.

“I especially began to hate their sound, which was not beating wings – how could I have ever thought it was? – but a lot of uneuphonious honks,” she writes. “Now we don’t go to Long Island in the summer and I don’t hear the geese. Sometimes, instead, we go to Los Angeles, where there are hummingbirds, and I love to watch them because they’re so busy getting the most out of life.”