The attack occurred in central Stockholm when a hijacked beer delivery truck plowed into a crow, killing four people and wounding 15 on Friday.
The suspect had applied for residency in Sweden in 2014 but his application was rejected in December a year ago, another police spokesman, Jan Evensson, told reporters.
The suspect was also said to have "showed sympathies" towards Islamic State and other extremist organisations.
Lars Bystrom, a spokesman for the regional police, said earlier Saturday, "We have one person in custody, and we think he is the driver of the truck".
He said there were clear similarities with the deadly terror attack in London last month, in which a British-born man used a vehicle to mow down a crowd of people on Westminster Bridge before he was shot and killed by the police. Four are seriously injured, of which two remain in intensive care.
Flowers are placed at a fence in front of the department store Ahlens following a suspected terror attack in central Stockholm, Sweden, Saturday, April 8, 2017.
Meanwhile, thousands of people gathered in central Stockholm later on Sunday for a vigil against terrorism and to honor the attack victims.
Sweden's prosecution authority said a second person had been arrested in connection with the attack on suspicion of having committed a terrorist offence through murder.
After Princess Victoria came a stream of public officials, including for the second time, Swedish Prime Minister Stefan Lofven who then walked the five blocks to parliament.
He added: "She was clear that the United Kingdom stands firmly by Sweden's side, and they agreed on the importance of working together to tackle these threats, which we all continue to face".
My favourite album to listen to is my own - Harry Styles
One of the songs on the album he wrote in the days before One Direction , admitting it's "a few years" old. One fan wrote: "I just died, got reborn, died again, went to heaven, and got reborn again".
The stolen truck, which was driven through a crowd outside a department in Stockholm on April 7, 2017, is removed from the area.
Theresa May pledged solidarity with the country in the wake of what she described as a "terrible attack" and said "the United Kingdom stands firmly by Sweden's side".
The Swedish news agency TT said several people had been rushed away from the scene in ambulances, and live television footage showed smoke coming out of the department store that the truck smashed into.
"There is nothing to indicate that we've got the wrong man".
There was no immediate claim of responsibility for the attack in Sweden, which has so far been largely immune from any major incidents of this kind, and police said they tightened security around the nation.
"We have confirmed that he is a man, 39 years old, from Uzbekistan". They would not confirm his status in Sweden.
Police said they had found a suspect device in the cab of the lorry that could be "a bomb or an incendiary object".
Sweden's Intelligence Agency says on its web page that there is "a large number of injured" in the truck crash.
He said he stayed in the bus a bit longer, before taking shelter in a clothing store on Kungsgatan.
In July 2016, a Tunisian man killed 86 people after driving a truck through Bastille Day celebrations in Nice, France, before he was shot and killed by police.