The ruling came in response to a Freedom of Information Act request from a public interest group, which said the public has a right to know about any spying on citizens.
The appeals court agreed that the NSA can reject the request, and does not even have to confirm whether it has any arrangement with the Internet giant.
"Any information pertaining to the relationship between Google and NSA would reveal protected information about NSA's implementation of its information assurance mission," Judge Janice Rogers Brown wrote in the appeals opinion.
The non-profit Electronic Privacy Information Center (EPIC) filed a formal request to make public documents related to the dealings, and said much of the information had already been in news media.
The request stemmed from a January 2010 cyber attack on Google that primarily targeted the Gmail email accounts of Chinese human rights activists.
According to the Google blog, the Internet group's chief legal officer David Drummond stated that the firm was notifying other companies that may have been targeted and was also working with the relevant US authorities.
The Wall Street Journal and Washington Post reported that Google had contacted the NSA immediately following the attack.
According to news reports, the NSA agreed to help Google analyze the attacks in a bid to better protect the California-based search company and its users from future intrusions.
The reported alliance would seek to allow the spy agency to evaluate Google's hardware and software vulnerabilities, as well as estimate the sophistication of its adversary in order to help the firm understand whether it has the right defenses in place.
The article is reproduced in accordance with Section 107 of title 17 of the Copyright Law of the United States relating to fair-use and is for the purposes of criticism, comment, news reporting, teaching, scholarship, and research.