Ahsanullah Master, a lawmaker from the Awami League, the main opposition party, was slain in May by armed men at a party rally in Tongi, an industrial town near Dhaka.
Violent opposition protests erupted across Bangladesh after the attack, in which three party workers also were killed.
After a six-month trial, Judge Shahed Nooruddin delivered the verdict on Saturday in a crowded courtroom amid tight security, prosecutor Latif Talukdar said.
The Awami League blamed the attack on Ahsanullah's political rivals. Tongi police later charged 30 people, including several supporters of Prime Minister Khaleda Zia's ruling Bangladesh Nationalist Party, with suspected involvement.
Two of the suspects were acquitted on Saturday.
"This was a brutal murder. So, there is no scope for taking a lenient view"
Those convicted planned to appeal to a higher court, their lawyers said.
Death sentences are carried out by hanging in Bangladesh.
Only 12 of those convicted are in custody, while the 16 others are fugitives and were tried in absentia. In his 61-page judgment, Nooruddin called the attack a "pre-planned murder," the United News of Bangladesh news agency reported.
"This was a brutal murder. So, there is no scope for taking a lenient view," Nooruddin said.
The court heard from 34 witnesses during the trial. Zahid Ahsan, the slain lawmaker's son, expressed satisfaction at the judgment.
"I would request the authorities to execute the verdict immediately," said Ahsan, who has been elected to his father's parliamentary seat.
Ahsanullah was at a rally with the
opposition Awami League party
"The verdict proves no one is above the law," government prosecutor Talukdar told reporters.
Prosecutors said about 20 gunmen attacked the opposition rally at a Tongi high school, killing Ahsanullah and the three others.
After his arrest, Mahbubur Rahman, one of the accused who was sentenced to death, confessed to the crime and named the other suspects, who included a local leader of the ruling party.
He helped police recover the guns allegedly used in the attack.