The punishment includes fines and prison terms of up to three years.
According to the new legislation, those who create and supply computer viruses would face a prison term of up to three years or fines of up to 500,000 yen. Those who acquire and store viruses will get up to two years' jail or fine of up to 300,000 yen.
Under the law, police can seize email communication logs of suspects from Internet service providers, among other information, said an AFP report.
According to a Jiji Press report, one of the bills calls for a revision to the Penal Code, which currently allows criminal complaints such as property destruction only after material damage is caused by computer viruses.
The new move faced severe opposition from privacy and free speech advocates.