European lawmakers approved an agreement on Thursday allowing U.S. authorities to obtain and store data on passengers flying to the United States from Europe, ending years of resistance to a deal on handing over such information.

A majority of members in the European Parliament approved a revised agreement on sharing flight passengers' data with the U.S. authorities, who have agreed to mask out passengers' names and contact details after six months.

The data will then be kept for up to five years, after which point it will move to a 'dormant' database for 10 years more.

EU Home Affairs Commissioner Cecilia Malmstrom said the agreement provides stronger protection for the right to citizens' privacy as well as more legal certainty for airlines.

At the same time, it fully meets the security needs of the United States of America and the EU. Under the new agreement, data of passengers travelling to the United States of America will be used to fight serious transnational crime and terrorism, she said in a statement.

The European Parliamentary approval marks a shift in EU resistance to sharing citizens' information with U.S. authorities.

Members of the parliament have battled for more than five years to scale back agreements that allow the United States to access and store the data of air passengers, arguing that it is an invasion of privacy that can lead to false arrests.

Prior to departure airlines must make the data available to U.S. authorities, including the names, addresses, credit card details and seat numbers of the travellers.

Critics of the agreement say passenger data has not helped U.S. authorities catch suspected criminals or terrorists but the Department of Homeland Security insists the data is needed to conduct criminal investigations anyway.

(Reporting by Claire Davenport; editing by Rex Merrifield)