Turkey's President Recep Tayyip Erdogan has warned that he will let hundreds of thousands of migrants travel on to Europe if pushed by the EU.
He was reacting to a non-binding vote by the European Parliament to freeze talks on EU membership for Turkey.
The MEPs were alarmed by Mr Erdogan's "disproportionate" response to a failed coup attempt in July.
The migrant numbers reaching the Greek islands have dropped since an EU-Turkey deal in March to curb the influx.
President Erdogan accused the EU of breaking its promises. As part of the March deal, Turkey was promised aid, visa-free travel for its nationals and accelerated membership talks.
"Listen to me: these border gates will be opened if you go any further," he warned the EU on Friday.
A spokeswoman for German Chancellor Angela Merkel, Ulrike Demmer, said the deal was in the "interest of all parties" and that "threats on either side are not helpful".
Turkey plays its trump card: Mark Lowen, BBC News, Istanbul
If the European Parliament hoped its vote to freeze accession talks with Turkey would prompt President Erdogan to row back on his policies, today came the answer.
It is Turkey's trump card: the key role it played in stemming the migrant flow under a deal with the EU to return failed asylum seekers here. And an increasingly combative Mr Erdogan seems ready to play it.
His tone - and his threat - are classic tactics of a president who knows Europe needs Turkey. And it is a sign that a man not known for a thick skin will not take the European Parliament vote lightly.
It is non-binding and Europe's leaders are unlikely to heed it, given how important Turkey is.
But the bad blood between the two sides is thickening - and the shaky EU-Turkey deal to halt the migrant flow looks more fragile still.
Turkey currently hosts almost three million migrants, mostly from Syria. Last year more than one million fled to Europe, mainly via Turkey.
Under the March 2016 agreement, migrants arriving in Greece are now sent back to Turkey if they do not apply for asylum or their claim is rejected.
For each Syrian migrant returned to Turkey, the EU is to take in another Syrian who has made a legitimate request.
Since then arrivals into Europe have slumped, as have the number of deaths of migrants making the dangerous sea crossing between Turkey and Greece.
Attempts to get visa-free travel for Turks stalled as the country refused to change its anti-terror laws and many in Europe have criticised Turkey's tough response to the failed coup.