General Motors on Tuesday beat Wall Street expectations for the third quarter but lowered its guidance for the year due to the United Auto Workers' 40-day strike against the automaker.

Share prices were up 4.5% in afternoon trading.

GM said the cost of the strike is expected to be $3.8 billion to $4 billion for the year to the company's earnings before interest and taxes, including $1 billion for the quarter. After accounting for about $900 million in taxes, interest and other adjustments, the strike shaved $2.9 billion off the company's bottom line for the year, it said. Roughly $700 million of that was in the third quarter after accounting for taxes.

GM now expects to earn $4.50 to $4.80 per share, down from its previous forecast of $6.50 to $7 per share. It also lowered its automotive adjusted free cash flow to a range of zero to $1 billion, down from $4.5 billion to $6 billion.

Here's what GM reported Wednesday compared with Wall Street's expectations, according to Refinitiv consensus estimates:

Adjusted earnings: $1.72 per share, vs $1.31 expected

Revenue: $35.47 billion vs. $33.82 billion expected.

The strike shaved 52 cents per share off the automaker's third-quarter earnings. Revaluations of its stake in Lyft and warrants from French automaker PSA Group took 15 cents per share off its earnings.

On an unadjusted basis, the company's quarterly profit dropped 7.6% to $2.31 billion, or $1.60 a share, from $2.5 billion, or $1.75 a share, during the same three months last year.

CFO Dhivya Suryadevara described the third-quarter as "very strong" despite a "significant impact" from the strike.

"If you look at our key operating segments, primarily North America, it was solid and that was driven by the strength in our crossovers and the continued strength in the launch of our full-size pickups, which really drove the earnings for North America," she told media Tuesday during a briefing on the quarter. "The underlying business was strong this quarter."

GM expects it lost about 300,000 units in production due to the strike, according to Suryadevara. She said the automaker also lowered its expected saving from cost-costing initiatives announced in November from $4.5 billion to between $4 billion and $4.5 billion through 2020.

"We're obviously going to maximize and figure out every opportunity to get every dollar we can from a cost-savings perspective," she said.

Wall Street analysts estimated the national work stoppage — the longest against GM since 1970 — cost the automaker more than $2 billion in lost production with the higher end of estimates at $100 million per day.

The strike ended on Friday with ratification of a new contract for GM's 48,000 union workers. The deal included pay raises, lump-sum bonuses and $11,000 ratification bonuses for most workers, among other benefits.

In August, prior to the strike, GM reconfirmed its full-year guidance for earnings per share of $6.50 to $7 per share. The company touted that it has beaten Wall Street estimates for 17-consecutive quarters.

Shares of GM have almost fully recovered from double-digit declines during the strike. The stock closed Monday at $36.64, down about 6% since before the strike started on Sept. 16.

Clarification: The cost of the strike is expected to be about $3.8 billion for the year to the company's earnings before interest and taxes. A previous version was unclear.