The foreign ministry said Prime Minister Sheikh Hasina sent a message to Spanish President Mariano Rajoy Brey expressing her sentiment on behalf of the country.
"I am deeply shocked and grieved at the terror attack", she wrote, "I, along with the people and the government of Bangladesh, strongly condemn such mindless act of cowardice and stand in solidarity with the people and the government of Spain."
"Terrorists are terrorists, irrespective of their colour, creed or religion and must have no place in any civilized society. We are together in the global fight against terrorism and violent extremism.
"I express our deepest condolences and sympathies to you and the people of Spain.
"Our thoughts and prayers are with the bereaved families, who have lost their loved ones, at this difficult hour," the Prime Minister wrote.
On Thursday, a suspected Islamist militant drove a van into crowds in Barcelona, Spain, killing 14 people and wounding scores of others.