General Motors and the United Auto Workers reached a tentative agreement on a new contract, clearing the way for a union vote Thursday on whether to continue a more than monthlong strike.

The accord, announced by the UAW on Wednesday, may bring an end to the union’s first national walkout against the carmaker in a dozen years. It includes $9 billion in investment in U.S. plants, signing bonuses exceeding the $8,000 that workers got four years ago, and annual pay raises and lump-sum bonuses over the life of the contract, people familiar with the matter said.

“The No. 1 priority of the national negotiation team has been to secure a strong and fair contract that our members deserve,” UAW vice president Terry Dittes said in a statement. He said the union’s bargaining committee recommends that the GM National Council — comprised of presidents and chairmen of locals around the country — vote in favor of putting the deal up for a ratification vote.

GM confirmed that a tentative agreement had been reached, but neither the company nor the union provided details on what’s included in the deal. GM shares rose as much as 2.6% to $37.22, the highest intraday in two weeks, before ending the trading day at $36.65, up $0.39 (1.08%).

The stakes were rising for both sides as the strike entered a fifth week, costing GM billions, forcing workers to live on $275 a week, and denting the economy in Michigan and the Midwest. Analysts at Bank of America Merrill Lynch estimate the strike has cost GM about $2 billion of earnings, and its striking workers may have lost $2,000 of profit sharing and as much as $4,000 in take-home pay.

The walkout also became a national political issue, coming up during Tuesday night’s Democratic presidential debate in Ohio, which has lost thousands of auto industry jobs.

The strike has affected nearly 46,000 workers around the country, including about 90 working at a warehouse in Langhorne.

If the UAW decides to continue the strike until the deal is ratified, the union may be pressured to expedite the process, said Art Schwartz, a former GM labor negotiator.

“If they keep them out, I’m sure they will speed ratification up,” said Schwartz, who is now a consultant in Ann Arbor, Mich. “Usually, it takes about two weeks, but it doesn’t have to; they can do it quicker, and I think they would.”

After exchanging blame last week, GM and the union made rapid progress over the weekend. Chief executive officer Mary Barra and president Mark Reuss showed up in person at the main bargaining table on Tuesday. And in an early sign a possible deal was in the works, UAW bosses summoned local presidents and chairmen to Detroit for a meeting Thursday.

GM and union officials reached a key compromise on a path to full-time employment for temporary staffers after three consecutive years of work, people familiar with the situation said. The treatment of temps, some of whom have worked at GM for as long as four years, had been one of the most contentious issues standing in the way of a deal.

The automaker said last week that it was willing to increase wages and lump-sum payments, preserve health-care benefits, remove a cap on how much profit sharing is paid out based on earnings, and boost ratification bonuses.

The UAW’s national council will decide Thursday whether to recommend the agreement for a ratification vote and if the strike will continue while members cast ballots.

“If they don’t feel confident in their ability to get it ratified, they may just say, ‘We’re going keep them out on strike until it’s ratified, because we’re not sure,’” said Arthur Wheaton, director of the Worker Institute at Cornell University. “It will be a great temperature test to see whether or not they feel confident in the vote.”

Getting the new four-year agreement approved by the rank-and-file could be a challenge. GM outraged union workers last year by threatening four U.S. plants with possible closure, though it’s offered to keep at least one of those factories open.

UAW leaders also have credibility problems. President Gary Jones was implicated last month by federal prosecutors in an indictment of a former confidant who conspired to embezzle member dues and spend the money on stays at luxury villas, golf gear, and cigars.

Once the UAW’s GM membership ratifies the contract, the union will turn its attention to either Ford or Fiat Chrysler. The UAW typically tries to use the first agreement as a pattern for the others. The union extended its contracts with Ford and Fiat Chrysler on Sept. 13 to focus on GM.