Illston's ruling puts a stop to the FBI practice, but the San Francisco district judge also granted the Justice Department a 90-day window to appeal the ruling with the 9th U.S. Circuit Court of Appeals, the AP reports.
Justice Department officials are in the process of reviewing the ruling.
The letters, authorized under the USA Patriot Act, granted the FBI access to customer information of U.S. citizens without judicial review and blocked recipients from publicly acknowledging they had been issued the letters.
Judges can lift the "gag order" on recipients, but only if they have "no reason to believe that disclosure may endanger the national security of the United States, interfere with a criminal counter-terrorism, or counterintelligence investigation, interfere with diplomatic relations, or endanger the life or physical safety of any person," according to the AP.
In 2011 alone, FBI agents issued over 16,000 national security letters to major banks and communications companies, according to the news service, requesting information on over 7,000 individuals -- focusing mostly on financial and phone records.
Friday's ruling was in response to a 2011 case brought by the Electronic Frontier Foundation, which filed suit on behalf of an unidentified telecommunications company that received an FBI demand for customer information, the AP reports.
An internal Justice Department review of the letter program in 2007 found a number of violations by FBI officials in issuing the letters for information without proper cause or authorization. The bureau has since revamped the letter program, in accordance with the department's review and recommendations.
Earlier this month, Google revealed statistics about the number of secretive national security requests for user data it receives every year from the FBI.
The company said that for each of the past four years, it has received fewer than one thousand of the requests.
Google said the requests only cover subscriber information, such as the names of the sender and receiver of an email. The company said it does not provide the contents of emails, search histories, YouTube videos or user IP addresses.
--This report was updated at 2:00 p.m.