The EU Asylum and Migration Pact has been in the works since 2015. It will come into force in two years' time.
It is designed to speed up the asylum process and boost the return of irregular migrants to home countries.
It will also require EU member states to share responsibility for asylum seekers.
Last year saw some 380,000 people illegally crossing the EU's borders - the highest number since 2016.
The EU said the pact combined "mandatory solidarity" between member states with flexibility. Although some EU states remain opposed to parts of the agreement, it is expected to receive full approval at the end of April under majority voting.
Under the proposed rules, the EU's 27 countries will be required to either take in thousands of migrants from "frontline" countries, such as Italy, Greece and Spain, or provide extra funding or resources instead.
The pact also says that asylum claims with "low chances of being accepted" should be examined rapidly, without necessarily admitting the applicant into EU territory.
The agreement also aims to deal with asylum requests within a maximum of 12 weeks. In case of rejection, asylum seekers would have to be returned forcibly to their home country within the same period.
Migrants will be subject to a toughened pre-entry screening procedure within seven days, which would include identification and health and security checks.
Biometric data for any migrant aged six or older will be collected and there will be a mechanism to respond to sudden increases in arrivals.
The migration pact has been backed by the two main political groups - the centre-right European People's Party Group (EPP Group) and the centre-left Progressive Alliance of Socialists and Democrats (S&D).
Both groups are trying to fend off a strong challenge from the right in parliamentary elections in June.
German Chancellor Olaf Scholz praised a "historic, indispensable step" and Roberta Metsola, the president of the European Parliament, said it struck a "balance between solidarity and responsibility".
"It will not solve everything overnight but it is 10 giant leaps forward," she said.
Hungary has vowed not to take any irregular migrants "regardless of any migration pact", and Polish Prime Minister Donald Tusk has rejected as "unacceptable" the mechanism of taking in some asylum seekers or paying into an EU fund for frontline states.
Although many MEPs welcomed the result, several also noted that the agreement was not "perfect".
"It is a compromise we can work with," said Slovenian MEP Matjaz Nemec, while Belgium's Hilde Vautmans said the legislation was "not perfect" but that she had voted for it nonetheless.
However, left-wing and far-right groups opposed the agreement.
Jordan Bardella of France's far-right National Rally said the migration pact was "terrible" and urged Europeans to vote against President Emmanuel Macron, who backed the agreement, at the upcoming European elections on 9 June.
At one point, protesters disrupted the vote, chanting "this pact kills, vote No" and throwing paper planes.
Many NGOs also urged MEPs to vote down the reform, with Amnesty International warning the pact would lead to a "surge in suffering" for asylum seekers.
One common objection from NGOs is that asylum seekers with low chances of being accepted would have their claims processed either on small border islands or in detention facilities in frontline states, and have less access to fair procedures.
The International Federation of Red Cross and Red Crescent Societies (IFRC) said it was worried by both "the normalisation of detention and speedier processes at borders". Quick decisions risked sending back people who should be granted asylum, it warned.
By Laura Gozzi