The court said there was public interest in interviewing Babar Ahmad, due to the case’s exceptional nature.
The Justice Secretary had argued an interview was not necessary to inform the public about Mr Ahmad’s story.
The British Muslim denies terror-related charges and is fighting extradition to the US.
After the ruling, the justice secretary said he would not be appealing the verdict and would now begin negotiations with the BBC about how and when the interview would take place.
The 38-year-old south London man has been held in prison pending extradition since 2004, believed to be a record for an unconvicted British citizen. He is awaiting a final decision on his case by the European Court of Human Rights.
Mr Ahmad is accused of fundraising for extremists and other offences, all of which are said to have been committed in the UK. He has never been charged or faced trial in this country and denies any wrongdoing.
Last year, more than 140,000 people signed an official government e-petition calling for him to be tried in the UK, leading MPs to include his case in two Parliamentary debates.
At the High Court hearing last year, the BBC argued that the Justice Secretary had the power to restrict journalists’ access to prisoners – but he had been wrong to turn down an application from reporter Dominic Casciani to film Mr Ahmad.
Lord Pannick QC, for the BBC, said that the refusal to allow an interview breached the journalist’s freedom of speech as set out in Article 10 of the European Convention on Human Rights.
In their judgement, Mr Justice Singh and Lord Justice Hooper said: “The [interview ban] constitutes a disproportionate interference with the right to freedom of expression in Article 10. In the circumstances of this particular case, the justification for that interference has not been convincingly established.
“The claimants have demonstrated on the evidence before the Court that they do require a face-to-face interview with Mr Ahmad.”
Counsel for the Justice Secretary had argued that allowing BBC cameras into prison would open the floodgates to many more such stories. But the court said Mr Ahmad’s case was “far from ordinary” and there was public interest in seeing and hearing from Mr Ahmad.
“It is difficult to think of a case which would fall within the exception if not for the present case,” said the judges.
“We make it clear that we do not consider that the present case should be regarded as setting any precedent for other cases.
“The crucial question is whether in the very unusual circumstances of the present case, when taken together, an exception must be made. We have come to the conclusion that it must.”