He beat out Benedict Cumberbatch (Sherlock: The Lying Detective), Robert De Niro (The Wizard of Lies), Ewan McGregor (Fargo), Geoffrey Rush (Genius) and his co-star John Turturro (The Night Of).
Ahmed was also nominated in the comedy guest star category this year for his appearance on Girls, but lost to Saturday Night Live host Dave Chappelle at last weekend's Creative Arts Awards, where The Night Of picked up four trophies.
Check Out Our Full Emmys Coverage
"If this show has shown a light on some of the prejudices in our society, Islamaphobia and the injustices in our justice system then that's something," Ahmed said while accepting the award.
He also gave out a shout out to Oprah Winfrey who sat front row at the award ceremony and thanked The Innocence Project, a non-profit that helped him prepare for his role in the HBO limited series that premiered earlier this year.
This would've also been the first Emmy win for De Niro and McGregor. Cumberbatch and Rush previously won this category in 2014 and 2005, respectively, while Turturro won for his guest turn on Monk in 2004.