The Dutch city beat Milan in a tiebreak after three rounds of secret voting by the 27 EU member states without Britain failed to produce an outright winner, officials said.
The new location for the European Banking Authority will be decided later today, with both London-based agencies up for grabs as a result of last year's shock Brexit vote.
EU President Donald Tusk said on Twitter before the vote that "whatever the outcome, the real winner of today's vote is EU27. Organised and getting ready for Brexit."
Copenhagen was in third place.
Also Read
Together the two agencies account for 1,000 jobs, as well as bringing both prestige to the host country and an economic boost in the form of tens of thousands of visitors every year.
The battle for both agencies has been bitterly contested with governments jostling to win the backing of other countries with "hot bargaining" behind the scenes, a diplomatic source told AFP.
There were 16 candidates to be the new home of the EMA, one of the world's most powerful drugs watchdogs, which employs 900 pharmaceutical experts, biologists and doctors from every corner of Europe.
There is a smaller batch of eight bidders for the EBA, the banking regulator with 159 staff. The EBA is perhaps best known for its regular stress tests on the EU's financial sector in the wake of the global financial crisis.
Member states brought out all the stops to extol the merits of their candidate cities, producing glossy brochures and videos and offering a host of perks.
The Irish government had said it was willing to contribute 78 million euros (USD 91.5 million) over 10 years to cover costs, while Vienna promised a children's nursery, and Milan threw in access to a gym.
Italy was even forced to deny news reports that it would increase its military contingents to the Baltic countries as a bargaining chip to promote Milan's candidacy.
In the second and third rounds they had one point each to distribute. In the end, Amsterdam and Milan had to draw lots.
One diplomatic source said his country had resorted to studying "game theory" to be ready.
The European Commission, the EU's executive arm, delivered an evaluation of the applications in September based on a range of criteria from transport links, to job prospects for spouses and schools.
Disclaimer: No Business Standard Journalist was involved in creation of this content