Judge PB Desai also sentenced 12 others to seven years in jail over the massacre of 69 Muslims who were hacked and burnt to death in a residential complex in the city of Ahmedabad in Gujarat.
One of the 24 Hindu men found guilty of involvement by the special court in Ahmedabad earlier this month was given a 10-year term.
The Gulbarg massacre (named after the housing complex) was one of the single worst losses of life in the week-long violence that left more than 1,000 people dead in total.
The riots have long dogged Modi, who was accused by human rights groups of turning a blind eye to the violence as head of Gujarat.
They were triggered by the death of 59 Hindu pilgrims in a train fire on February 27, 2002 that was initially blamed on Muslims.
Modi was cleared of any wrongdoing in 2012 by a Supreme Court-ordered investigation.
More than 300 witnesses gave evidence during the years-long trial that began in 2009 but was delayed by legal challenges. Several of the original accused died.
Prosecutors had sought the death penalty for all 24 convicted, arguing that those targeted – among them women and children – were all innocent people.