KYIV, Sept 21 (Reuters) - Ukraine agreed to license its grain exports to Slovakia on Thursday and pushed for a deal with Poland to end restrictions by its neighbours on grain that it has been forced to send overland since Russia's invasion last year.

Slovakia, Poland and Hungary imposed national restrictions on Ukrainian grain imports last week after the European Union executive decided not to extend its ban on imports into those countries and fellow bloc members Bulgaria and Romania.

The countries have argued that cheap Ukrainian agricultural goods meant mainly to transit further west and to ports, get sold locally, harming their own farmers. The EU, which imposed its ban in May, let it expire on Friday after Ukraine vowed to tighten controls.

For much of the last year, some 60% of grain from Ukraine, one of the world's biggest exporters, has transited through the five eastern EU countries.

The row escalated as Ukraine, which turned to land routes to the west after a de facto Russian blockade of its Black Sea ports, filed a complaint with the World Trade Organisation (WTO) over the bans and threatened retaliatory import restrictions.

Slovakia's agriculture ministry said it had agreed with Ukraine to set up a licensing system for trading in grains, which, once established, would allow a ban on imports of four Ukrainian commodities to Slovakia to be lifted.

"(Ministers) agreed on creating a grain trade system based on issuing and controlling licences," the Slovak ministry said by email. "Until this system is up and running and fully tested, the ban on imports of four commodities from Ukraine remains in place."

Ukraine had agree to drop its WTO complaint, the Slovak ministry said. Ukrainian officials did not immediately comment on that. A WTO spokesperson said there was no information at present on a possible cancellation of Ukraine's request for consultations.

Ukraine said its farm minister, in a phone call with his Polish counterpart, agreed to work out a solution to the grain dispute in the interests of both countries.

"There is no person in Ukraine who would be interested in creating any problems for Polish farmers," Ukraine's ambassador to Poland Vasyl Zvarych told Poland's state-run news agency PAP, adding that he thought an accord on the grain issue could be reached.

Spain's agriculture minister on Monday said the bans seemed illegal while his French counterpart said they called European solidarity into question.

President Volodymyr Zelenskiy angered his neighbours when he told the United Nations General Assembly Kyiv was working to preserve land routes for grain exports, but that the "political theatre" around grain imports was only helping Moscow.

Ukraine last month announced a humanitarian corridor to release ships stuck in its ports bound for African and Asian markets. The corridor, which hugs the western shores of the Black Sea, aims to circumvent the de facto Russian blockade after Moscow abandoned a deal this summer that had guaranteed its exports during the war.

The first vessel loaded with grain from Ukraine to sail in and out of the Black Sea using the temporary corridor arrived off Turkey's Bosphorus Strait on Thursday.

(Additional reporting by Pavel Polityuk in Kyiv, Jan Lopatka in Prague, Alan Charlish in Warsaw and Gabrielle Tetrault-Farber in Geneva; writing by Philippa Fletcher; editing by Andrew Cawthorne)