Canada’s Liberal Party won a fourth term in office but appeared short of a majority in Parliament, which could force Prime Minister Mark Carney to seek help from rival politicians to push through an economic agenda designed to contain fallout from President Trump’s trade war.

Preliminary estimates early Tuesday from Elections Canada, the government body overseeing elections, indicate the Liberals had 43% of the popular vote, compared with 42% for the Conservatives. The Liberals won or were in the lead in 167 of the 343 seats in Parliament. Pollsters had predicted a Liberal majority, but the Conservative Party outperformed expectations in Ontario, especially in the suburbs around Toronto. Votes were still being counted and several close races had yet to be called.

Without a majority, Carney, the former head of the Bank of Canada and the Bank of England, faces a challenge in negotiating a new economic and security deal with Trump while also maintaining support in Parliament.

“Americans want our land, our resources, our water, our country,” Carney said as he declared victory in front of several hundred supporters in Ottawa. “We are over the shock of the American betrayal, but we shall never forget the lessons. We have to look out for ourselves and above all, we have to take care of each other.”

Carney, 60 years old, became prime minister after Justin Trudeau stepped down in January. His victory is a remarkable one for a party headed for defeat at the start of this year. The Conservatives, led by Pierre Poilievre , had more than a 20-point lead in January, reflecting voter fatigue with a three-term Trudeau administration and anger over inflation and high housing costs.

FILE PHOTO: Canada’s Prime Minister Justin Trudeau looks on during a press conference while responding to U.S. President Donald Trump’s orders to impose 25% tariffs on Canadian imports, in Ottawa, Ontario, Canada February 1, 2025. REUTERS/Patrick Doyle/File Photo

Trudeau’s resignation after a decade in power and Trump’s return to the White House precipitated a reversal in fortunes for the Liberals under Carney, who said he was the best candidate to handle Trump and reshape an economy dependent on U.S. demand. Left-leaning politicians in Australia and the U.K., too, have benefited from appearing to best embody opposition to Trump’s plans.

“What began as a campaign about change eventually morphed into a campaign about leadership,” said Darrell Bricker, president of polling firm Ipsos.

Carney said he would in the coming days talk to Trump about a new economic and security deal between the North American neighbors.

He has pledged to boost military spending to allay U.S. criticism but has established lines that can’t be crossed in talks, such as control of Canadian resources, changes to its language laws, agricultural policy and sovereignty.

Carney has said Canada needs to lower internal trade barriers and do more business with Europe and Asia after decades of ever-tightening economic and security cooperation with the U.S. He touted his experience leading the Bank of Canada during the financial crisis and the Bank of England after the U.K. voted to leave the European Union.

FILE PHOTO: A sign that reads ”Buy Canadian Instead” is displayed on top of bottles, hanging above another sign that reads “American Whiskey”, after the top five U.S. liquor brands were removed from sale at a B.C. Liquor Store, as part of a response to U.S. President Donald Trump’s 25% tariffs on Canadian goods, in Vancouver, British Columbia, Canada, February 2, 2025. REUTERS/Chris Helgren/File Photo

“Carney has the economic know-how to deal with a childlike Trump,” Maria Longo, a mortgage broker from Montreal, said over the weekend ahead of the vote. “Trump is ruining the world.”

Poilievre suffered for rhetoric too similar to Trump’s, pollsters said. Abacus Data polling last week indicated that 46% of Canadians held a negative perception of Poilievre, the highest level since the start of the campaign.

He spoke to his supporters early Tuesday, and congratulated Carney for winning what he called a “razor-thin” minority government.

“I know some of you may be disappointed that change did not come tonight,” said Poilievre. “We know that change is needed, but change is hard to come by. It takes time.”

Trump said in a social-media post Monday morning that Canada would be better off as the 51st state, a frequent refrain since he was elected that has stoked Canadian patriotism and galvanized voters.

Canada election

Canada’s Prime Minister Mark Carney exits his campaign bus, before boarding an aircraft, after calling for an election, in Ottawa, Ontario, Canada March 23, 2025. REUTERS/Blair Gable

Throughout the campaign, Carney said he was seeking a strong mandate to help counter Trump at the negotiating table. A parliamentary minority could complicate those efforts as well as his ability to implement an economic agenda to deal with a protectionist U.S., said Scott Reid, a senior aide to former Liberal Prime Minister Paul Martin. “We are going to ask our prime minister to make decisions that may be broadly unpopular or specifically unpopular among certain regions and sectors,” he told Canada’s CTV News. “It is much harder to do that when you are in a minority parliament.”

Results showed that the Conservatives, with more than 40% of the popular vote, bested their performance in the 2011 election, when they won a majority government. The Liberals, though, benefited from a drop in support for smaller parties, notably the left-wing New Democratic Party and the nationalist Bloc Quebecois in Quebec .

Carney distanced himself from Trudeau’s inability to raise living standards or cut housing costs. He acknowledged the economy was weak before Trump started imposing tariffs and said Trudeau’s team didn’t focus enough on economic policy. Spending was too tilted toward government programs and administration and not enough toward increased investment in the country, said Carney, a former Goldman Sachs banker.

He has said that after the election he intends to use a combination of tax cuts and spending to reinvigorate an economy in dire need of a confidence boost. And Carney wants to start talks with the Trump administration on a new economic and security pact. Throughout the campaign, he warned that the U.S. is no longer a reliable trading and security partner.

Write to Paul Vieira at Paul.Vieira@wsj.com and Vipal Monga at vipal.monga@wsj.com