"Moonlight," the made-in-Miami drama about a gay young man growing up in Liberty City, pulled a stunning upset over the heavily favored "La La Land" at the 89th Academy Awards, winning Best Picture — moments after presenters Warren Beatty and Faye Dunaway had already announced "La La Land" had won the prize.

The cast and crew of the song-and-dance musical, which had already won six Oscars, had taken to the stage to celebrate when "La La Land" producer Jordan Horowitz noticed the title of the winning movie on the card was "Moonlight." He flashed the card to the cameras.

Director Barry Jenkins and the "Moonlight" team eventually came on stage to accept the Best Picture prize while expressing his admiration for "La La Land."

"It is so humbling to be standing up here," Jenkins said. "There was a time when I thought this movie was impossible because I couldn't bring it to fruition. Everybody behind me on this stage said, 'No, that's not acceptable,' so I just wanna thank everyone behind me."

Jenkins, who wrote and directed the film, and playwright Tarell Alvin McCraney, whose original work inspired the film, shared the Oscar for Best Adapted Screenplay. Both men were born in Miami grew up within blocks of each other in Liberty City, raised by mothers struggling with drug addiction.

Throughout the rounds of interviews they had done to promote the film, Jenkins and McCraney had stressed the importance of inclusion and on-screen representation of minorities, pointing out how many kids living in impoverished neighborhoods like they once did can often feel invisible.

"All you people out there who feel like there's no mirror for you, that your life is not reflected, the Academy has your back, the ACLU has your back, we have your back and for the next four years we will not leave you alone. We will not forget you," Jenkins said.

"Thank God for my mother, who proved to me through her struggles that we can really be here and be somebody, two boys from Liberty City up here on this stage representing 305," McCraney said. "This goes out to all those black and brown boys and girls and non-gender-confirming who don't see themselves ... this is for you."

"Moonlight" also won Best Supporting Actor for Mahershala Ali for his performance as a drug dealer who becomes a father figure to a bullied little boy.

A visibly moved Ali thanked his acting teachers and professors for teaching him that acting "isn't about you; it's about these characters." Ali also thanked Jenkins and McCraney. He also revealed that he and his wife had just celebrated the birth of their daughter four days earlier.

"La La Land," the song-and-dance musical about two dreamers in L.A. who fall in love while trying to break into show business, won six Oscars, including Best Actress (for Emma Stone) and Best Director for 32-year-old Damien Chazelle — the youngest filmmaker ever to win in the category.

"A moment like this is a huge confluence of luck and opportunity," Stone said while thanking her co-star Gosling for making her laugh throughout their adventure making the movie and director Chazelle for a "once-in-a-lifetime opportunity."

"I still have a lot of growing and learning and work to do, and this guy is a really beautiful symbol to continue on that journey," the 28-year-old actress said while holding her award.

"Manchester By the Sea," a drama about a man forced to care for his nephew after the death of his brother, won Best Actor for Casey Affleck and Best Original Screenplay for writer-director Kenneth Lonergan.

"Man, I wish I had something bigger and more meaningful to say," Affleck said while accepting the award. "I'm really proud to be a part of this community. I look out at all of you, and I've had this whole year, and I'm dumbfounded I'm included."

As expected, Viola Davis won Best Supporting Actress for her performance as a wife who stands up to her adulterous husband in "Fences," an adaptation of the Pulitzer Prize-winning play by the late August Wilson.

"There's one place where all the people with the greatest potential are gathered, and that's the graveyard," Davis said through tears. "People ask me all the time: 'What kind of stories do you want to tell, Viola?' And I say 'exhume those bodies.' Exhume those stories. People who dreamed big and never saw those dreams to fruition. I became an artist and thank God I did, because we are the only profession that celebrates what it means to lead a life. So here's to August Wilson, who exhumed and exalted the ordinary people."

Taraji P. Henson, Octavia Spencer and Janelle Monae, the three stars of the hit drama "Hidden Figures," about the contributions by African-American mathematicians to the early years of the NASA space program, took the stage to present the award for Best Documentary Feature. They were joined by 98-year-old Katherine G. Johnson, the woman Henson plays in the film.

"O.J. Simpson: Made in America" won the award, becoming the longest movie (467 minutes) ever to win an Oscar. Co-director Ezra Edelman, son of children's rights activist Marian Wright Edelman, dedicated the award to Nicole Brown, Ron Goldman and "victims of police violence and brutality and racially-motivated violence."

"The Salesman," a drama about a married couple in Tehran in the middle of rehearsals for an upcoming production of "Death of a Salesman," won director Asghard Farhadi his second Oscar for Best Foreign Language Film (his first was for 2012's "A Separation.") The award was accepted by Anousheh Ansari, an Iranian-American engineer, on behalf of Farhadi, who had announced he would not be attending the ceremony in protest of President Trump's immigration ban.

"It's a great honor to be receiving this valuable award for the second time," Ansari read from a statement written by Farhadi. "I'm sorry I'm not with you tonight. My absence is out of respect for the people of my country and those of other six nations who have been disrespected by the inhumane law that bars entry of immigrants into the U.S. Dividing the world into the us and our enemies categories creates fear ... Filmmakers can turn their cameras to capture shared human qualities and break stereotypes of various nationalities and religions. They create empathy between us and others, an empathy we need today more than ever."

Before presenting the Best Animated Feature to "Zootopia," actor Gael Garcia Bernal also commented on the President's policies, this time focusing on his plan to build a wall between the U.S.-Mexico border.

"Flesh and blood actors are migrant workers," Bernal said. "We travel all over the world, we build families, we construct stories, we build life but we cannot be divided. As a Mexican, as a Latin American, as a migrant worker, as a human being, I'm against any sort of wall that wants to separate us."

The critically-reviled comic-book movie "Suicide Squad" became an Oscar winner, taking the prize for Best Makeup and Hair. Mel Gibson's World War II drama "Hacksaw Ridge" won two awards, for Sound Mixing and a surprising Best Editing win.

"Arrival," which was nominated in eight categories, had to settle for Best Sound Editing, while "Fantastic Beasts and Where to Find Them" won Best Costumes.

Justin Timberlake kick-started the telecast with a rousing rendition of his Oscar-nominated song "Can't Stop the Feeling!" from the movie "Trolls," which resulted in the rare sight of such actors as Michael Shannon, Isabelle Huppert and Meryl Streep dancing in their seats.

Host Jimmy Kimmel's opening monologue leaned on insider Hollywood jokes, such as another installment in his ongoing "feud" with actor Matt Damon. But most of his one-liners delivered the expected political jabs.

"I want to say thank you to President Trump," Kimmel said. "Remember last year when it seemed like the Oscars were racist? That's gone."

Kimmel took a moment to single out Oscar-nominee Meryl Streep, who bore the brunt of President Trump's angry tweets after a speech she gave at the Golden Globes.

"This is Meryl's 20th Oscar nomination," Kimmel said about Streep, who was up for Best Actress for her performance in "Florence Foster Jenkins." "It's even more amazing that she wasn't even in a movie this year. We just wrote her name in out of habit. The highly overrated Meryl Streep, everyone! Nice dress, by the way. Is that an Ivanka?"