Under the guidelines, updating rules from 1991, only people over 18 not deemed a threat to public safety can buy and keep guns. People under 18 will only be able to get hold of a gun for hunting or target shooting under the guidance of an adult with a valid license.
EU member states will be required to keep computer files with data on each firearm, such as type, model, caliber, serial number and names and addresses of both the supplier and the buyer, including on guns bought through the Internet. Data will have to be kept for at least 20 years.
The name of manufacturer, place and year of fabrication and serial number will have to marked on every firearm. Individual collectors or historical collection of arms will be exempt from the new guidelines.
The measures, which still need to be formally approved by EU governments, are expected to come into force by January, the parliament said. All EU member states will then have two years to adopt them.
The parliamentary vote took place less than a month after an 18-year-old student went on a rampage in a school in southern Finland, killing eight people and himself. Although the legislation has been 18 months in the making, parliamentarians said they saw a pressing need to pass the new rules to prevent such massacres in the future.
"A 100-percent risk-free environment can never be created. But we can try to prevent events such as those in Finland or Germany," said Gisela Kallenbach, a German Green deputy charged with steering the legislation through the EU assembly. Germany has seen five tragic school shootings in the past seven years.
British Labour deputy Arlene McCarthy said the assembly sought a 'fast-track' adoption of the rules following the Finnish killings.
The new rules bring the EU into line with a U.N. protocol on firearms and harmonize the different gun control measures across the bloc.
In Finland, for example, 15-year-olds are allowed hunting rifle permits, and there are 1.6 million registered guns in a population of 5.3 million. In Britain, 17-year-olds may buy a shotgun if they have a gun certificate.
"Guns are not something young people should be getting hold of ... Recent dramatic events have shown just how necessary it is to have better control of the purchase and circulation of arms," said EU Commission Vice President Guenter Verheugen, a German.
"The conditions of use of firearms by persons less than 18 years old will be strictly controlled and the purchase of firearms by minors will be forbidden," he said.
Verheugen estimated there were "millions" of illegally-owned weapons in the EU.
"We have a tough job ahead of us trying to get these guns out of the system," he said.
Germany raised the age for owning recreational firearms from 18 to 21 after the massacre in a school in Erfurt in 2002 when a 19-year-old man killed 13 teachers, two former classmates and a policeman, before committing suicide.
Countries that have more stringent gun controls than the new minimum EU-wide standards will be allowed to keep them.
McCarthy said public auction Web sites such as eBay have been instructed how to conduct Internet firearms sales.