Fifty-seven people were killed and hundreds injured in the bombings, which took place in Ahmedabad, the commercial capital of Gujarat.
The court in Ahmedabad also sentenced 11 other convicts to life in prison until death.
The accused can challenge their sentences in a higher court.
The Indian Mujahideen – then an unknown Islamic militant group – had claimed responsibility for the attacks in an email sent to some media outlets.
In the Ahmedabad blasts, 78 people had faced trial – one of the accused, Ayaz Saiyed, later helped investigating agencies.
The remaining 28 have been acquitted.
The prosecution examined 1,163 witnesses over the course of the trial, according to The Indian Express.
Special Judge AR Patel also ordered to give compensation of 100,000 rupees (£982; $1,337) each to families of the victims.
In 2013, authorities had said they foiled an attempt by some of the accused to tunnel their way out of jail.