Sweden's parliament on Wednesday overwhelmingly voted through an EU-backed law obliging telecom and Internet operators to store data traffic information for at least six months.
The proposal passed with 233 in favour, 41 opposed and 19 abstentions, the TT news agency said.
The new law, which will take effect May 1, requires all operators to store information on subscribers, including who they contact by phone or over the Internet, how long the conversation lasts and their location at the time, for at least six months.
However, the contents of the communications will not be stored.
"The (stored) information will when necessary be used to reveal, investigate and press charges in connection with serious crimes," parliament said in a statement.
All European Union countries were tasked with implementing the 2006 EU directive on data retention before March 2009, but Sweden had been dragging its feet on the matter due to concern over how storing traffic data would impact on privacy.
In 2010, the European Commission filed a complaint against Sweden for not complying with the directive, and the Scandinavian country faced the threat of heavy fines if it did not move on the matter.
Centre Party lawmaker Johan Linander regretted the bill had been passed.
"The need for, and the benefits of, the directive do not compensate for the invasion of privacy," TT quoted him as saying.
Swedish police chief Klas Friberg claimed meanwhile that the directive would make it more difficult to catch criminals.
"My opinion is that it weakens our capacity to fight serious crime," he told TT, saying the six-month limit on data storage was too narrow.
"The time period is too short. Today we're able to access information that is older than six months," he said.
Explore further: Swedish Internet firm to delete user data