Suzanne Breen, northern editor of the Dublin-published Sunday Tribune, had been subject to a legal bid by PSNI chief constable Sir Hugh Orde, who wanted information on the murders of two British soldiers in March.
Northern Ireland-based Ms Breen received the Real IRA's claim of responsibility for shooting dead Sappers Patrick Azimkar, 21, from London, and Mark Quinsey, 23, from Birmingham, at the gates of Massereene Army Base in Antrim.
She also conducted an interview with a member of the organisation for her newspaper.
Notes
When she refused to hand over her mobile phone records and notes to officers investigating the murders, Sir Hugh went to court seeking an order to compel her.
Protection of the identity of sources was "an absolute" which, if broken, would prevent her being trusted again, Ms Breen said.
"It is the lynchpin of investigative journalism. We are journalists. We are not detectives. We chose to become journalists, not to become police officers or detectives."
Belfast Recorder Tom Burgess acknowledged that there was a great public interest in catching the killers but said the journalist's right to life outweighs that.
He rejected police argument that there was no immediate threat to the journalist, stating it was obvious that such a risk would only become real if the data was relinquished.
The judge described the Real IRA as a "ruthless and murderous group of people" who would have no hesitation in targeting the reporter.
"The group has the capacity to carry out such threat and is willing to carry out such actions," he said.
'Delighted'
An overjoyed Miss Breen described her relief at the ruling outside the court.
The journalist, who had potentially been facing a term in prison, said the case against her should never have been taken.
"I am just delighted the judge came to the right decision," she said.
"The past few months have obviously been very stressful, I think this action by police should never have been taken.
"I think it was a complete waste of time, resources and of taxpayers' money and hopefully the police will learn from this decision and no other journalist will find themselves in the position that I found myself, potentially facing up to five years for doing nothing other than my job."
The reporter was flanked by supporters and representatives from the National Union of Journalists, which backed her case, as she left Laganside Court in Belfast.
NUJ secretary, Seamus Dooley, hailed the judgment as a landmark ruling.
He said journalism would have been badly damaged if the decision had gone the other way.
"It would have been a major blow to journalism," he said.
Amnesty International has also welcomed the ruling.
The human rights organisation's Northern Ireland Programme director Patrick Corrigan said: "This case had serious implications for the freedom of the press in the UK and Ireland.
"We welcome today's decision but remain concerned at this attempt by the PSNI to use secret evidence and anti-terrorism legislation against a journalist."
A police spokesman said the PSNI accepted the decision of the court.
He added: "Nevertheless, the investigation into this atrocity remains active and ongoing.
"Police will continue to endeavour to use every possible legal means to access information which may assist their inquiries.
"All the victims of the Massereene attack, their families and the community expect and deserve nothing less."