The union and government have been at odds since the spring as the union's 1,350 members have been staging rotating job action at the Foreign Affairs headquarters in Ottawa and more than a dozen missions abroad.
Treasury Board President Tony Clement announced that he signed a tentative agreement with Tim Edwards, President of the Professional Association of Foreign Service Officers.
The foreign service staff were seeking parity with their counterparts in other federal departments, who they say make as much as $14,000 more doing similar work.
The union, which has been without a contract since mid-2011, has been in a legal strike position since April.
Details of the settlement were not immediately available.
"This tentative agreement reflects the government's commitment to reaching fiscally responsible settlements that are fair to Canadian taxpayers and to employees," Clement said in a statement.
"The settlement represents the efforts of both parties to reach an agreement that is aligned with what was accepted by other public- and private-sector employees.
Tim Edwards, the union president, said he was satisfied with the deal.
"This agreement was reached through compromises on both sides," Edwards said in a statement.
"We salute the spirit of constructive engagement which our employer brought to our latest discussions. This deal is a victory for free and fair bargaining in the federal public service."
The union ordered an immediate suspension of all strike measures and job action.
The strike was the longest in the federal public service since the introduction of collective bargaining in the late 1960s, the union said.
NDP foreign affairs critic Paul Dewar, whose Ottawa riding is home to many public servants, welcomed the settlement but blasted the government.
"This labour dispute could have been completely avoided, if the Conservatives had chosen to engage in good-faith bargaining rather than discrediting our diplomats," he said.
"Canada's international presence depends on the patriotic dedication of our talented foreign service officers. Our diplomats take on personal risk and hardship in being posted abroad — they deserve our respect and gratitude for their service to our country."
Earlier this month, the Public Service Labour Relations Board ruled that the government had been bargaining in bad faith.
But in its 27-page decision, the board did not impose a remedy in the long-running saga that universities and tourism groups say has deprived foreign students and travellers from getting the visas they need to come to Canada.
The decision urged the Treasury Board and the union to go back to bargaining to break the impasse.
"I conclude that the respondent engaged in bad faith bargaining in its approach," the ruling stated.
"I do not believe that it is conducive to good labour relations to order parties to participate in final and binding determination when such arbitration is voluntary in the first place,'' it added.
Also on HuffPost