An 18-year-old woman was killed in the attack and a 19-year-old man later died from his injuries. Both were students at a local technical college.
Another seven people were hurt, including a 23-year-old police officer who was wounded as she left her vehicle after arriving at the scene, a police spokesman said.
"Shooting erupted suddenly," Jani Kuronen, a man in his 20s, told public television YLE.
"People starting running. One person had a horrible wound on the face. I called an ambulance."
Another witness, Santeri Silvenoinen, said he heard the gunshots and "then looking around me, I saw a woman lying on the ground and I started running".
Police did not identify the suspect, but said he was dressed in camouflage fatigues. He was arrested near Hyvinkaa, a city of 45,000 people, without putting up any resistance.
Three firearms including a hunting rife were seized from the suspect, who was not in possession of any gun permits, police said. The suspect had no criminal record.
Asked about the gunman's motives, police spokesman Satu Koivo said an investigation was ongoing, adding: "For the moment, it is not possible to confirm anything."
The spokesman told AFP, however, that police did not believe that the gunman knew his victims.
Mika Ihaksinen from the National Bureau of Investigation, who is leading the investigation, told newspaper Ilta-Sanomat: "According to his friends the shooter has not been politically active and he doesn't follow any particular ideology." Hyvinkaa mayor Raimo Lahti told YLE that the whole town was in shock.
On September 23, 2008, a student who went on a murderous rampage at a school in Kauhajoki in the southwest killed 10 people before turning his gun on himself.
In a similar incident on November 7, 2007, at Jokela, not far from Hyvinkaa, an 18-year-old killed seven classmates and the headmistress then shot himself in the head.
Finland has one of the highest gun ownership rates in the world and a series of mass shootings prompted the Government to toughen its gun laws last June.
- Agencies