Spain's interior ministry apologised to journalists and denied muzzling the media on Tuesday after a report revealed it had secretly compiled a list of reporters and their political opinions.

The rare freedom of expression row in the EU nation comes with the Socialist-run ministry already under fire over its handling of July's unprecedented migrant surge into Spain's north African territory of Ceuta.

Online newspaper El Confidencial published on Tuesday an exclusive about "a dossier on dozens and dozens of active journalists... to monitor their political affiliation", including directors and popular columnists.

"The document was drawn up in secret... and contains a large number of files" on the journalists accompanied by photographs and "comments on their work and political positions", El Confidencial said.

"Controversial journalist", "independent", "conservative tendency", "far right", "disinformation", "clearly left wing and supports the government", "lately more combative" and "radical right-wing ideology" were among the descriptions cited by the newspaper.