The trial, over the smuggling of nearly two tonnes of heroin, began in Quang Ninh province in early January.
Dozens of others were also given prison sentences from two years to life.
This is the largest-ever drug trial in Vietnam in terms of the number of defendants and the death sentences given, says the BBC’s Nga Pham.
A total of 89 defendants, including the 21 men and nine women who were sentenced to death, were arrested last year on various charges.
They belong to different drug rings accused of smuggling the heroin from Laos through Vietnam and China since 2006, state media report.
Presiding Judge Ngo Duc told AFP news agency that the trial was held at the prison because of the seriousness of the case.
This is only the first stage of a special investigation carried out by Quang Ninh police, and the extent of the crimes may be a lot larger, our correspondent reports from neighbouring Bangkok.
Punishments for drug-related crimes in Vietnam are relatively harsh, but this trial shows the immensity of drug trafficking problems in the country, our correspondent adds.
At least 86 people were sentenced to death in 2012, with more than 500 on death row in Vietnam, rights group Amnesty International said in its annual report 2013.