The Special Court in Belgrade ruled that former special police commander Milorad Ulemek organized the murder, while his deputy, Zvezdan Jovanovic, fired the shots.
Ulemek and Jovanovic each received the maximum sentence of 40 years in prison.
The court said they had conspired with 10 others, who received sentences of between eight and 35 years.
Chief Judge Nata Mesarovic called it a "political murder" with the aim of destabilizing the state.
She said the 12 had conspired to kill Djindjic to halt his pro-Western reforms, to bring allies of former Yugoslav President Slobodan Milosevic back to power, and to stop further extradition of war crimes suspects to The Hague.
(with agency material)