Host Jimmy Kimmel speaks at the Oscars at the Dolby Theatre in Los Angeles. Picture: Chris Pizzello/Invision/AP

Los Angeles – Viola Davis and Mahershala Ali won Oscars on Sunday for their supporting roles in African-American stories "Fences" and "Moonlight" on a night where diversity, and digs at US President Donald Trump, both loomed large.

Ali, and a tearful Davis, each winning their first Oscars, were among a record seven actors of color nominated for Academy Awards this year, in stark contrast to 2016 when there were none.

With a leading 14 nominations, romantic musical "La La Land" won for orignal score and theme song "City of Stars" for its tale of a struggling actress (Emma Stone) and a jazz pianist (Ryan Gosling).

But the chances of "La La Land" equaling the 11 Oscars record held by "Titanic," "Ben-Hur," and "Lord of the Rings: The Return of the King," slipped away as the musical lost some early technical awards.

The biggest awards – for best picture, director and lead actress and actor – will be handed out at the end of the three and a half hour show.

Trump, and actress Meryl Streep, took centre stage as host Jimmy Kimmel fired off political zingers after an awards season marked by celebrity opposition to the Republican president and his policies.

"I want to say thank you to President Trump. Remember last year when it seemed like the Oscars were racist?" quipped Kimmel in an apparent reference to Trump's crackdown on immigrants and travelers from seven majority Muslim nations.

Streep, 67, was given a standing ovation by the audience after Kimmel recalled how Trump had derided the actress as "overrated" after she attacked him at the Golden Globes ceremony in January.

"Meryl Streep has phoned it in for more than 50 films in the course of her lackluster career," Kimmel quipped as triple Oscar winner Streep squirmed in her seat.

Kimmel later said he was concerned that Trump, known for his heavy use of Twitter, had not tweeted during Sunday's show.

"Hey @realDonaldTrump, u up?", Kimmel tweeted to Trump, adding #merylsayshi. His tweet was retweeted 100 000 times in just the first five minutes.

Several celebrities wore blue ribbons on Sunday in support of the American Civil Liberties Union (ACLU) advocacy group that worked to get Trump's travel ban blocked in US courts.

Iran's "The Salesman" was named best foreign language film but its director, Asghar Farhadi, boycotted Sunday's ceremony because of the Trump's controversial bid to ban travelers from seven majority Muslim nations, including Iran.

In a speech delivered on his behalf by Iranian-American space expert Anousheh Ansari, Farhadi said his absence was due to "an inhumane law that bans entry into the US... Dividing the world into the 'us' and 'our enemies' categories creates fear, a deceitful justification for aggression and war."

Cheryl Boone Isaacs, president of the Academy of Motion Picture Arts and Sciences which votes on the Oscar winners, made no mention of Trump when she took the stage on Sunday.

But she told the audience of A-listers and the millions of people watching on television around the world that, "tonight is proof that art has no borders, art has no single language and art does not belong to a single faith. The power of art is that it transcends these things," she said.