The EU has approved on the use of weedkiller glyphosate for the next five years after a heated debate over whether it causes cancer.
Diplomats said Germany swung the vote, after abstaining in previous meetings to oppose its key EU partner France, which wanted a shorter licence extension.
The European Commission said in a statement that 18 countries had backed its proposal to renew the chemical's licence, with nine voting against and one abstaining, declaring this to be a "positive opinion".
Europe has been wrestling for the past two years over what to do with the chemical, a key ingredient in Monsanto's top-selling Roundup, whose licence was set to expire on 15 December.
President of the Irish Farmers' Association Joe Healy said it was an important outcome for farmers and for science.
While it would have been better to have a longer renewal, it does stand up to those who wanted to ignore scientific advice, he said.
He said: "The European Food Safety Agency has endorsed the use of glyphosate and has consistently said it is safe. Today's vote backs up that position.
"Glyphosate is an integral part of the modern farming practice in both tillage and grassland production.
"It is a key arable crop management tool that allows farmers to produce an abundance of safe, affordable, quality food."
The chemical has been used by farmers for more than 40 years, but its safety was cast in doubt when a World Health Organisation agency, the International Agency for Research on Cancer (IARC), concluded in 2015 it probably causes cancer.
The European Union agreed to roll over the licence for 18 months pending the results of a study by the European Chemicals Agency, which said in March this year that there was no evidence linking glyphosate to cancer in humans.
Protest groups, however, seized on the IARC report, questioned the science in other studies and complained about the influence of big business.
In theory, the commission could have pushed through a licence extension, but it said it wanted governments to make the call on an issue that has become so politically charged.
After a series of indecisive votes, they finally produced a clear majority in favour of the commission's proposal.
"Today's vote shows that when we all want to, we are able to share and accept our collective responsibility in decision-making," said health and food safety commissioner Vytenis Andriukaitis.
Diplomats said the key swing vote came from Germany, whose government is still operating in an acting capacity following an indecisive September election. Germany abstained earlier, but threw its weight behind a decision opposed by France.
Three other abstainers, Poland, Bulgaria and Romania, all did likewise leaving only Portugal on the fence.
The result could scarcely have been closer.
The extension required 16 states representing 65% of the EU's population to vote in favour. The 18 supporters account for 65.7%.