Ali, a first time nominee, played a Miami drug dealer who mentors a young boy who is being teased and bullied in the heartbreaking coming of age tale. It has been a breakout year for Ali, who starred in the Netflix series Luke Cage and also had a role in another Oscar-nominated film, Hidden Figures.
The 43-year-old actor paid tribute to his teachers and Moonlight director Barry Jenkins in his acceptance speech and glowed on stage as he thanked his wife, who gave birth to their daughter four days earlier.
Ali portrays conflicted neighbourhood dealer Juan, who takes Chiron under his wing. The role won Ali best supporting actor at the Screen Actors Guild Awards, and a nomination at the Golden Globes.
Ali, whose mother is a Christian minister, converted to Islam in 1999. Speaking at the SAG Award the actor said his mother "didn't do back flips" when he converted to Islam.
Over the years Muslims have won Academy Awards, including Pakistani documentary filmmaker Sharmeen Obaid-Chinoy and Iranian director Asghar Farhadi, but none has taken a statuette for acting.
Ali recently told Britain's Radio Times magazine that he discovered he was on an FBI watchlist after the September 11, 2001 attacks.
"If you convert to Islam after a couple of decades of being a black man in the US, the discrimination you receive as a Muslim doesn't feel like a shock," he said.
"I've been pulled over, asked where my gun is, asked if I'm a pimp, had my car pulled apart. Muslims will feel like there's this new discrimination that they hadn't received before -- but it's not new for us."
He also revealed that his wife stopped wearing a head scarf in New York "as she had so many bad experiences".
Ali's victory was also the first Oscar for an African-American actor since Forest Whitaker won top acting honours for 2006's The Last King of Scotland.
Ali's Oscar nomination was one of several for actors and actresses of colour this year, a reversal from last year's all-white slate of nominees that provoked a backlash, #OscarsSoWhite.