If you stayed up to watch the end of the Oscars you got to see two films win for best picture, "La La Land" and moments later after some confusion, the real winner "Moonlight."

Oscar presenters Warren Beatty and Faye Dunaway incorrectly announced "La La Land" as the best picture winner, a mistake that wasn't corrected until the filmmakers had already given their acceptance speeches onstage.

Moments later the filmmakers of "Moonlight" were ushered onstage and presented with the Oscar.

Click here for full coverage of the "Moonlight" mix-up.

Earlier, Emma Stone's portrayal of a struggling actress in "La La Land" has won her the best actress Academy Award.

Stone won for her portrayal of Mia, an aspiring actress forced to suffer the indignities of failed auditions and working as a barista at a studio cafe. Her character's career gets a nudge from a struggling jazz pianist played by Ryan Gosling.

It is the actress' first Oscar, and comes during a year in which "La La Land" and its catchy song-and-dance numbers have charmed Hollywood. The film tied history with its 14 Oscar nominations.

It is the sixth Oscar "La La Land" has won Sunday.

Casey Affleck's portrayal of a grieving father in "Manchester by the Sea" won him the best actor Academy Award.

It is Affleck's first Oscar. He is the younger brother of Ben Affleck and took the "Manchester" part after Matt Damon had to drop the role.

Affleck appeared to get emotional after his win. He thanked Denzel Washington, who he said taught him how to act but who he had never met before Sunday's ceremony.

Affleck plays a janitor who's still reeling from the loss of his son when he is forced to confront another death in his family. "Manchester by the Sea" is also nominated for best picture.

Damien Chazelle won the best director Academy Award for the film "La La Land."

Chazelle also wrote the screenplay for "La La Land," which is vying to become the first musical in 15 years to win the best picture Oscar. His film is an homage to past musicals, and stars Emma Stone and Ryan Gosling.

He is the youngest best director winner.

As Mahershala Ali took home the first award of the evening winning the best supporting actor Oscar for 'Moonlight,' Sunday night's Oscars were shaping up to be one of the most turbulent and politically charged ceremonies in recent memory.

Ali won for his first Oscar-nominated role, in which he plays a Miami drug dealer who mentors a young boy who is being teased and bullied.

It has been a breakout year for Ali, who starred on the Netflix series "Luke Cage" and also had a role in another Oscar-nominated film, "Hidden Figures."

Ali paid tribute to his teachers and "Moonlight" director Barry Jenkins in his acceptance speech and thanked his wife, who gave birth to their daughter four days ago.

Viola Davis won the supporting actress Academy Award for her role in "Fences."

Davis won for her portrayal of a mother determined to hold her family together despite the rages of her husband, who is played by best actor nominee Denzel Washington.

The Oscar win comes in a role that Davis previously won a Tony Award for when she starred opposite Washington in a Broadway revival of "Fences." The film is the first big-screen adaptation of an August Wilson play.

Davis said in her acceptance speech, "Here's to August Wilson who exhumed and exalted the ordinary people." She also praised Washington and her parents, breaking down in tears.

The Oscars started off on an upbeat note with Justin Timberlake dancing in the aisles of the Dolby Theater and interacting with some of Hollywood's biggest stars.

Timberlake kicked off the show with a performance of his Oscar-nominated song "Can't Stop the Feeling" that included a high-five with Denzel Washington. Actor Javiar Bardem danced like he was in a nightclub.

The singer had promised a politics-free opening to the 89th annual Oscars, and he delivered.

Host Jimmy Kimmel kept the mood light in his opening, telling Timberlake that if his former bandmates in 'N Sync were watching, they'd let him back into the band.

Kimmel didn't stray entirely from politics, and urged audience members to reach out to someone with opposite views from them. He also took a shot at President Donald Trump, saying his policies had made the Oscars seem less racist.

The three-hour-plus telecast, on ABC, is expected to resemble one very glitzy protest against President Donald Trump, whom award-winners — like Meryl Streep at the Golden Globes — have railed against throughout Hollywood's awards season.

It's not only actors getting standing ovations at Sunday's Oscars — the audience gave a resounding welcome to a former NASA mathematician who is an inspiration for the film "Hidden Figures."

Mathematician Katherine Johnson was brought out on stage to thunderous applause in an introduction by the actresses who portrayed Johnson and other female black mathematicians in the best picture nominee.

At least one woman in the audience was seen crying at the recognition for Johnson, who was part of a group of black women who helped put NASA ahead in the Space Race against the Soviet Union.

Johnson is played in the film by Taraji P. Henson.

The 98-year-old Johnson wore a blue dress and was brought out in a wheelchair during Sunday's ceremony. She thanked the audience for their resounding welcome.

A documentary examining the broad implications of O.J. Simpson's trial and acquittal on murder charges has won the Oscar for best documentary.

The ESPN film "O.J.: Made in America" runs seven hours and 47 minutes and is the longest film to win an Academy Award.

"O.J." documentary director Ezra Edelman paid tribute to Simpson's late wife, Nicole Brown Simpson, and Ron Goldman, whose brutal killings led to the so-called "Trial of the Century" against the former NFL great.

The film is one of several documentary contenders this year that examine racial issues in America, including "I Am Not Your Negro" and "13th."

Iran's "The Salesman" has won the Academy Award for best foreign language film.

It is the second win in the category for writer-director Asghar Farhadi, who previously won for 2011's "A Separation." He boycotted the Oscars in protest of the travel ban imposed by President Donald Trump's administration.

In a statement read on his behalf, Farhadi wrote that filmmakers create empathy between others, and that is more needed today than ever.

"The Salesman" is a thriller about a married couple's attempts to find peace and justice in Tehran after the wife is attacked in her apartment.

"La La Land's" ''City of Stars" is the winner of the Academy Award for best original song.

Ryan Gosling and Emma Stone perform a duet of the song in the film. It beat out another "La La Land" song, "Audition (The Fools Who Dream)," for the Oscar.

It includes music from "La La Land" composer Justin Hurwitz, and lyrics by Benj Pasek and Justin Paul.

"La La Land" won the best original score Oscar. Hurwitz also wrote the film's score.

The wins for "La La Land" came after a montage of the film's two nominated songs was performed by John Legend.

An unusually tense atmosphere has coalesced before the Dolby Theatre ceremony, with protests, rallies and boycotts swirling around this year's Oscars. Even the normally sunny California weather has been stormy, and light rain fell Sunday as stars arrived on the covered red carpet.

"It's crazy to be at the prom," said Lin-Manuel Miranda, the Broadway star who is to perform his nominated song from "Moana." He brought his mother, Luz, as his date.

Yet most expect another day of sun for Damien Chazelle's celebrated musical "La La Land," up for a record-tying 14 nominations. A best picture upset, while unlikely, isn't out the question, though. Barry Jenkins' eight-time nominated "Moonlight" on Saturday took best feature at the Film Independent Spirit Awards, where "La La Land" wasn't eligible.

The other films up for best picture are Denis Villeneuve's "Arrival," Denzel Washington's "Fences," Mel Gibson's "Hacksaw Ridge," David Mackenzie's "Hell or High Water," Theodore Melfi's "Hidden Figures," Kenneth Lonergan's "Manchester by the Sea" and Garth Davis' "Lion."

The "OscarsSoWhite" crisis of the last two years was largely quelled this season by a richly diverse slate of nominees, thanks to films like "Moonlight," ''Fences" and "Hidden Figures." A record six black actors are nominated. For the first time ever, a person of color is nominated in each acting category. And four of the five best documentary nominees were also directed by black filmmakers.

The nominees follow the efforts by Academy of Motions Pictures Arts and Sciences President Cheryl Boone Isaacs to diversify the membership of the largely white, older and male film academy. In June, the academy added 683 new members: 46 percent of them were female; 41-percent were nonwhite; and they pulled from 59 countries.

The academy and ABC will be hoping to improve on last year's telecast. The Chris Rock-hosted show drew 34.4 million viewers, an eight-year low. Ads this year are still going for $2.1 million for 30-second spots.

Politics pervaded Oscar weekend, usually a time of frothy anticipation of Hollywood's big night:

— On Friday, the United Talent Agency, forgoing its usual Oscar party, instead held a rally protesting Trump over immigration. "We will not tolerate chaos and ineptitude and war-mongering," Jodie Foster told attendees.

— Also on Friday, the six directors of the foreign film nominees released a joint statement condemning "the climate of fanaticism and nationalism we see today in the U.S. and in so many other countries." The signees included the Iranian director Asghar Farhadi, whose "The Salesman" is favored to win him his second foreign language Oscar. He isn't attending the awards in protest of Trump's proposed travel ban of seven predominantly Muslim nations, including Iran.

— U.S. immigration authorities are barring entry to a 21-year-old Syrian cinematographer who worked on the documentary short nominee "The White Helmets," about the nation's civil war.

— The Academy of Motion Pictures also added best actress nominee Streep ("Florence Foster Jenkins") to its lineup of A-list presenters. Her fiery remarks at the Golden Globes prompted Trump to call her "overrated."