BRUSSELS — The European Union and Canada signed a far-reaching trade agreement on Sunday that commits them to opening their markets to greater competition, after overcoming a last-minute political obstacle that reflected the growing skepticism toward globalization in much of the developed world.

Canada’s prime minister, Justin Trudeau, had been forced to call off an earlier trip to sign the deal after Wallonia, the French-speaking region of Belgium, used its veto to withhold Belgium’s approval of the deal. The pact required the support of all 28 European Union countries.

On Friday, Wallonia, which has been hit hard by deindustrialization and feared greater agricultural competition, withdrew its veto after concessions were made by the Belgian government, including promises to protect farmers. Hours later, the European Union announced that the deal was back on track.

Mr. Trudeau signed the pact on Sunday, joined by Donald Tusk, the president of the European Council, which represents the leaders of the member states; Prime Minister Robert Fico of Slovakia, which holds the rotating presidency of the body that runs the bloc’s ministerial meetings; and Jean-Claude Juncker, the president of the European Commission, the bloc’s executive arm.