He opened fire from his apartment and pursued people in the street, police said. Armed with a Swiss military rifle and a handgun, he then threatened to shoot the officers sent in to stop him, police said.
"The shooter pointed his weapon at our colleagues, so they had to open fire to neutralize him, to avoid being injured themselves," police spokesman Jean-Marie Bornet told Swiss radio.
The suspect, whom police did not identify, was arrested and taken to a hospital with serious wounds. Bornet said he lived in Daillon, but the motive for the shooting was unclear.
Guns are popular among the Swiss - the Alpine country has at least 2.3 million weapons among a population of less than 8 million. Many rural areas have gun clubs, with children as young as 10 taking part in shooting competitions.
The suspect was using a military rifle that was once standard issue in the Swiss army, interim cantonal police chief Robert Steiner said.
Prosecutor Catherine Seppey said the suspect was unemployed and had been receiving psychiatric care since at least 2005, when he was first admitted to a psychiatric hospital. He was currently under the care of the cantonal agency for the disabled, she said.
His weapons were confiscated and destroyed in 2005, she said, "and currently no arms register showed he had a weapon. The inquiry will have to determine where the weapons came from."
Buying a firearm in a Swiss shop requires a permit, a clean criminal record and no psychiatric disability, but buying a firearm from another person is less restrictive and old-style army rifles are often sold at military surplus markets.
Most types of ammunition can be bought, while automatic firearms generally require a special police permit.
Seppey said the shooter knew several of the victims but "he was not known for making threats."
The victims were three women ages 32, 54 and 79 who died at the scene, and two injured men, ages 33 and 63, who were taken to the hospital, Seppey said. The two youngest victims were a couple with small children.
Daillon is near some of Switzerland's most popular ski resorts, such as Verbier and Crans-Montana, and is in the country's main wine-producing region. The area also boasts a sizable share of the country's federally protected hunting reserves.