Japan and the European Union agreed on Thursday to a free trade pact, creating the world's biggest open economic area and signalling resistance to what they see as US President Donald Trump's protectionist turn.