The regulations relate in particular to governments ensuring the secrecy of journalistic sources and banning the use of spyware in devices used by journalists.
Sweden's Culture Minister Parisa Liljestrand said E.U. states were looking to "strengthen protection for media providers and their sources."
But media activists warned last-minute changes demanded by France had widened the exemptions for governments to spy on journalists on "national security" grounds.
"The possibility of monitoring journalists in the name of national security is an open door to all sort of abuses," said Julie Majerczak, Brussels director at Reporters Without Borders.
Renate Schroeder, director of the European Federation of Journalists, decried the "dangerous loopholes" and said the exemptions dealt a "blow to media freedom."
"It puts journalists even more at risk and creates in addition a chilling effect on whistleblowers and other sources," she said.
The European Commission, the E.U.'s executive arm, welcomed the agreement by the bloc's member states and called for it to become law soon.
"Major step towards first-ever E.U. rules to protect media pluralism and freedom. We should all do more to protect journalists," said commission official Vera Jourova, who proposed the law last year.
"I hope the Parliament can work quickly and we get a final deal soon."