The agreement - a key tool in Washington's "war on terror" - has given US authorities the right to trawl through 34 pieces of information about each passenger.
It includes name, address and credit card details obtained within 15 minutes of departure for the US.
But the European Court of Justice - acting on a complaint filed by the European parliament - ruled on Tuesday that the deal was drawn up illegally in 2004.
The ruling has no immediate effect on trans-Atlantic air traffic, passenger security or privacy standards but it forces EU and US officials to make changes legalising the deal before the end of September.
The judges did not address the issue of whether the data agreement violates privacy laws - a major complaint in Europe that led many legislators and citizens' rights groups to strongly voice their opposition before the agreement was reached in 2004.
The court only considered the legal basis for such a pact, and concluded that it was illegally adopted.
The court attacked the way the European Commission made the decision, saying it was wrong to assume EU data privacy laws governed the transfer of information to US anti-terrorist authorities.
The commission had argued that rules used for transferring data between businesses could be used because the information was collected by airlines.
"My view is that we will need to continue exchanging passenger data between the US and Europe for purposes of preventing terrorist attacks"
European justice commissioner
The court said this was incorrect because the information ended up in the hands of law enforcement authorities.
EU and US officials, however, said they were confident they could find a compromise by a court-imposed September 30 deadline to come up with new regulations.
If they fail to fix legal technicalities by that date, airlines may have to change the way they collect and transfer data.
The European parliament had asked the court to annul the deal.
Stewart Baker, the assistant secretary for policy at the US department of homeland security, said: "It's unimaginable that the data would cease to flow, that planes would cease to fly.
"I am confident we will find a resolution that will keep the data flowing and the planes flying."
Baker spoke during a debate in Washington on common US and European strategies on homeland security.
Frattini (C) is confident of a new
agreement on sharing information
European justice commissioner Franco Frattini, who was taking part in the debate from Brussels via teleconference, also said he was confident a new agreement on sharing passenger information would be reached.
"My view is that we will need to continue exchanging passenger data between the US and Europe for purposes of preventing terrorist attacks," Frattini said.
"I cannot imagine stopping the flow of exchanging data concerning the protection and security of people travelling to America from Europe and vice versa."
Frattini said he planned to meet EU interior ministers on Thursday to present them with new suggestions.
"I am confident that all member states of Europe will agree on the importance of having a new initiative under a different legal basis but, in my view, similar concerning the content," he said.
Washington has warned that airlines face fines of up to $6,000 per passenger and the loss of landing rights if the relevant information is not passed on.
Airline representatives also expressed confidence that changes could be made to comply with the ruling without jeopardising the substance of the agreement.
During the negotiations, the EU won some concessions from the United States, including shortening the time the information is stored and deleting sensitive data like meal preference, which could indicate a passenger's religion or ethnicity.
The US also said the information would be shared with other countries on a restricted basis only.