The musical “La La Land” waltzed away with six Oscars Sunday night but, in a bizarre mix-up, found its Oscar for best picture taken away at the last minute.

After representatives of the musical joyously accepted their Oscar for best picture, “La La Land” producer Jordan Horowitz realized that the official card he was holding read “Moonlight.”

“This is not a joke,” Horowitz said, holding the card up to the cameras. “It’s ‘Moonlight.’ ”

Barry Jenkins, the director of “Moonlight,” took the mic in a daze and said, “Even in my dreams, this could not be true. But to hell with dreams! This is true!”

Warren Beatty and Faye Dunaway, presenters for the best-picture award, apparently took the wrong envelope onto the stage. Then Dunaway read “La La Land” after chiding Beatty for taking so long to read the winner. After Horowitz pointed out the error at the mic, Beatty announced he paused so long before the name was read because the envelope stated, “Emma Stone, ‘La La Land.’ ”

Stone did win best actress, while Casey Affleck of “Manchester by the Sea” took home the Oscar for best actor.

advertisement | advertise on newsday

The surprise upset for the top award — and the odd way it unfolded — capped an otherwise smooth-sailing night. The show began on an upbeat note, with Justin Timberlake singing his Oscar-nominated “Can’t Stop the Feeling!” through a crowd of famous faces. First-time host Jimmy Kimmel kept his material topical but gentle, tweeting President Donald Trump in real time and tweaking him by writing, “Meryl says hi,” a reference to Trump’s tweet calling Meryl Streep “overrated” after Streep criticized him in her Golden Globes speech.

More serious political issues dotted the broadcast, as when Asghar Farhadi, the Iranian director who boycotted the ceremony in the wake of the recent travel ban, sent Iranian astronaut Anousheh Ansari to read a statement that called the ban “a deceitful justification for aggression and war.” Overall, though, the fiery political speeches that viewers may have feared or expected did not materialize.

Aside from “La La Land,” the night’s other big winner was diversity. Five African-Americans took home major awards, including supporting actors Mahershala Ali, who played a drug-dealer in “Moonlight,” and Viola Davis, who played a long-suffering wife in “Fences.” Director Ezra Edelman took home an Oscar for his 8-hour documentary “O.J.: Made in America.” Jenkins and Tarell Alvin McCraney won adapted screenplay for “Moonlight,” the story of a gay African-American boy growing up in Miami.

“I became an artist, and thank God I did,” Davis said during a long and emotional acceptance speech, “because we are the only profession that celebrates what it means to live a life.”

Jenkins held up his Oscar as proof that African-American were making inroads into the film industry, while McCraney dedicated his award to gays and transgender people of color. “We’re trying to show you ‘you’ — and us,” he said. “Thank you, thank you. This is for you.”

Mel Gibson’s World War II biopic “Hacksaw Ridge” took home two awards, for sound mixing and film editing, while the sci-fi drama “Arrival” won sound editing. Disney’s animated allegory about tolerance, “Zootopia,” won best animated feature.

Other highlights:

ALMOST THERE. Davis becomes the first African-American to win an Oscar, an Emmy (in 2015, for “How to Get Away with Murder”) and a Tony (“Fences” in 2010 and “King Hedley II” in 2001). Can she sing, too? A future Grammy would make her part of the exclusive “EGOT” club.

THE REAL DEAL. Taraji P. Henson, who played the NASA mathematician Katherine Johnson in “Hidden Figures,” brings the woman herself, now 98 and in a wheelchair, onto the stage. She said only “thank you.”

BEST TOUR EVER. Kimmel brought an unsuspecting group of tourists off their bus and into the Dolby Theater live on television, where they meet many of Hollywood’s biggest names. Two of the group, an engaged couple from Chicago, were pronounced man and wife by Denzel Washington (the bride-to-be’s favorite actor).

advertisement | advertise on newsday

21st TIME’S THE CHARM. Long Island-born, Los Angeles-raised Kevin O’Connell won for best sound mixing for “Hacksaw Ridge” (along with Peter Grace, Robert Mackenzie and Andy Wright). It’s O’Connell’s first victory after 21 total nominations — he had been the most-nominated person in Oscars history without a win.