OTTAWA—Canada’s border agents ended a nearly daylong partial strike Friday after their union and the Canadian government struck a new labor deal, removing a potential roadblock for Americans, who can begin visiting their northern neighbor Monday for the first time in 16 months.

The Public Service Alliance of Canada, which negotiates on behalf of about 9,000 employees at the Canada Border Services Agency, said it clinched a four-year agreement after more than 36 hours of mediator-supervised talks. A mediator was brought in midweek to help resolve differences, which the union said focused on working conditions and compensation.

Government and union negotiators failed to reach a deal before a 6 a.m. ET Friday deadline, and that prompted unionized customs and immigrations officers to slow down the processing of trucks and travelers, and refrain from activity that isn’t required under the job description. The move caused long delays for shippers and travelers trying to cross the land border into Canada.

“We are relieved that CBSA and the government finally stepped up to address the most important issues for our members to avoid a prolonged labor dispute,” said Chris Aylward, national president of the Public Service Alliance. He added the work-to-rule campaign would cease immediately.

The Canadian government said the tentative four-year agreement provides pay increases of 2%-plus in the first two years, along with other enhanced benefits, such as extended parental leave. Border agents have been without a contract for over three years.

The labor disruption had an immediate impact. Video posted Friday to social media showed a lengthy line of trucks stuck on Interstate 75 in Detroit, en route to the Ambassador Bridge which connects Michigan to Canada. The U.S. Department of Transportation said the bridge is the single busiest international land-border crossing in North America, accounting for 27% of the roughly $400 billion in annual trade between the U.S. and Canada.

Data from the Canadian border authority’s website indicated commercial truckers in the U.S. faced delays of two to four hours to enter Canada at major land crossings in Michigan, Vermont, New York, North Dakota, Montana, and Washington.

A prolonged strike would have affected Canadian manufacturers’ “ability to get the essential components and goods to sustain global supply chains and threatens thousands of Canadian businesses,” said Dennis Darby, head of the Canadian Manufacturers and Exporters, a lobby group.

For Canadian businesses in the hospitality and hotel sector, the big concern was any labor disruption would dissuade American tourists from visiting Canada starting Monday, when the country begins to lift pandemic-related border restrictions. Canada is opening its borders to fully vaccinated U.S. citizens living in the U.S. to enter for tourism and recreation purposes, subject to obtaining a negative molecular Covid-19 test 72 hours before arrival.

Canadian businesses tied to tourism and hospitality, whose revenues plummeted due to the Covid-19 pandemic and border restrictions in place since last year, were counting on a partial reopening at the U.S.-Canada border to help salvage what is left of the summer season.

Canada plans to open its borders to fully vaccinated tourists from countries other than the U.S. in early September.

“For the people who did their share and got vaccinated, we owe it to them to get back to somewhat of a normal life,” Canadian Prime Minister Justin Trudeau said this week about border reopening plans. “We cannot fully live in fear.”

Write to Paul Vieira at paul.vieira@wsj.com