Catalan police were treating the incident as an act of terrorism and sealed off the area. Catalan President Carles Puigdemont said two suspects had been arrested. More than 100 people were injured, authorities said, 15 of them in a serious condition.
One Belgian was killed in the attack, Belgian Foreign Ministry spokesman Jose de Pierpont said.
Authorities said that a Moroccan and Spanish national from Melilla, a Spanish city on Africa's north coast that is near Morocco, were arrested. The two were not believed to be the driver of the van used during Thursday's attack.
Barcelona officials ordered all public events to be canceled, and metro and train stations in the area were closed.
Reports of the incident emerged on social media about 5 p.m. (11 a.m. ET). Photographs and videos showed people fleeing the area. About two hours later, police confirmed a terror attack.
It was the latest in a series of attacks in Europe in which vehicles have been used to mow down pedestrians in public spaces. More than 100 people have died in similar attacks in Berlin, London and Nice.
ISIS' media wing, Amaq, said the perpetrators of the Barcelona attack were "soldiers of the Islamic State." However, ISIS has not explicitly claimed responsibility.
Catalan police said they were continuing to hunt for the perpetrators and that the force had activated its terror response protocols. Unconfirmed reports suggested the suspects may have been attempting to reach a getaway vehicle.
Catalan police later tweeted that a driver had run over two police officers at a security checkpoint in Barcelona and that the driver had been found near the city. The two officers suffered minor injuries and did not need hospital treatment, police said. It was unclear whether that incident was related to the terror attack.
Local Spanish media earlier reported that two armed men had entered a restaurant. But Catalan police dismissed rumors the attacker had been holed up near Las Ramblas and said there "was never a hostage situation."
As the incident unfolded, police told everyone in the vicinity of Plaça de Catalunya and Las Ramblas to remain indoors until told it was safe to go outside. Footage posted to social media by witnesses showed chaotic scenes with people lying in the street, apparently dead or injured.
Witness reports gunshots
One witness told local media the situation was "very tense" and that all surrounding shops were being evacuated. The witness said at least eight ambulances were at the scene. Emergency services said the area had been cordoned off and all public transportation stopped.
Another witness who was hiding in a shop nearby heard gunshots, according to state-run broadcaster TVE24. A third said he saw a van driving "around 80" kph, or 50 mph. He said "there is no doubt it was intentional," according to TVE24.
Ali Shirazinia, who was cycling alongside Las Ramblas at the time, told CNN he heard "a lot of screams" and saw the crowds of people split along the busy promenade.
Then he heard what sounded like the driver flooring the accelerator and saw a white van with blue markings come hurtling down the street. "It literally came right down the Ramblas and ran into people on every side," he said.
"The Ramblas is full of pedestrians, street merchants, street performers, and I saw people flying into the air and everyone was running into the shops on either side of the Ramblas, a lot of people were shocked."
Tourist Susan McClean told CNN she saw a "tidal wave" of people running away from Las Ramblas after the incident.
She ducked into a nearby shop and the shutters were pulled down while police sped toward the scene.
"There was clearly a lot of distress," she said.
McClean said she returned to her hotel one street away after leaving the shop.
Government officials respond
The Catalan regional government said it was holding an emergency meeting to discuss the incident.
The Catalan emergency services urged people via Twitter to avoid going out or undertaking any other type of movement that is not "strictly necessary" to facilitate police operations.
Spanish Prime Minister Mariano Rajoy tweeted: "The terrorists will never defeat a united people who love freedom versus barbarism. All of Spain is with the families and their victims."
The Spanish royal family tweeted: "They are assassins, simply criminals who are not going to terrorize us. All of Spain is Barcelona. Las Ramblas will return to be everyone's."
The Union of Islamic Communities of Catalonia expressed "condemnation and repulse" for the Barcelona attack.
"Faced with this criminal fact, the union of Islamic communities in Catalonia reiterates its full commitment to the fight against any type of terrorism, and it is expected that those responsible for these attacks may be detained and brought before the courts as early as possible," its statement said.
NATO chief: We stand united
World leaders were quick to voice their condemnation of the attack and offer support to Barcelona via Twitter.
"My thoughts are with all those affected. We stand united in the fight against terrorism," said NATO Secretary General Jens Stoltenberg.
US President Donald Trump said: "The United States condemns the terror attack in Barcelona, Spain, and will do whatever is necessary to help. Be tough & strong, we love you!"
London Mayor Sadiq Khan also gave his support, saying: "London stands with Barcelona against the evil of terrorism."
German Chancellor Angela Merkel called the attack in Barcelona "revolting," her spokesman tweeted. "We are mourning the victims of this disgusting attack in Barcelona -- in solidarity and friendship side by side with the Spanish."
European Commission President Jean-Claude Juncker branded the Barcelona attack "cowardly," adding: "We will never be cowed by such barbarism."
Las Ramblas is a predominantly pedestrianized street popular among tourists in Barcelona. Extending for about three-quarters of a mile through the center of the city, the tree-lined street is especially crowded in the summer, the height of tourist season.
The promenade passes by kiosks, flower sellers, pavement cafes and bars. It includes a number of the city's most popular sites.