Glyphosate - introduced under the name Roundup by USA agriculture giant Monsanto in 1974 - previously had a 15-year licence but it expired in June 2016.
The EU health commissioner Vytenis Andriukaitis said: "Today's vote shows that when we all want to, we are able to share and accept our collective responsibility in decision making".
The chemical has been used by farmers for more than 40 years, but its safety was cast into doubt when a World Health Organisation agency, the International Agency for Research on Cancer (IARC), concluded in 2015 it probably causes cancer.
French prime minister Edouard Philippe, said in a statement France "regretted" the EU's decision to vote in favour of the chemical's licence renewal; while environment minister Nicolas Hulot told RTL radio a five year licence was "too long".
In theory, the Commission could have pushed through a license extension, but it said it wanted governments to make the call on an issue that has become so politically charged.
Adrien Bebb, of Friends of the Earth Europe, described the vote as "a missed opportunity", and Phillipe Lamberts, leader of the Greens in the European Parliament, tweeted: "Public health sacrificed again for profit". Pekka Pesonen, president of the Copa-Cogeca farmer group, welcomed the limited extension but insisted that glyphosate "should have been reauthorized for 15 years after it was given a positive assessment by both the European Food Safety Authority and the European Chemicals Agency". It also reduces the need for ploughing, which benefits the environment and enables farmers to apply no tillage, which reduces soil erosion, and keeps soil organic matters up.
Traces of glyphosate are routinely found in tests of foodstuffs, water, topsoil, and human urine in amounts way above safe limits set by regulators. European Union nations long failed to find a compromise amid conflicting health reports.
More than 280 similar lawsuits are now pending against Monsanto, according to the USA right to know campaign. The Papers include a host of documents from U.S. regulators and United States scientists, as well as thousands of pages of internal Monsanto emails, memos and other documents.
France's biggest farm union, the FNSEA hailed the EU's "pragmatic" decision to extend the chemical's licence, and deplored France's decision to "isolate" itself from the rest of the bloc.