DETROIT (Reuters) - General Motors Co GM.N posted a better-than-expected net profit on Thursday as high-margin pickup trucks, SUVs and crossovers helped overcome slowing sales in the United States and China, and reiterated its full-year earnings forecast.

GM shares gained 3.3% to over a one-year high.

Virtually all of the No. 1 U.S. automaker’s profit came from North America, where it posted a profit margin of 10.7% and profits came in $400 million ahead of analysts’ expectations.

Evercore ISI analyst Chris McNally, in a research note entitled, “Truck, truck and away...,” said the rest of the year and 2020 could be the company’s “time to shine.”

“The alarm clock may be softly ringing for GM to finally reawaken from its trading range slumber,” he said of the stock.

GM executives said things will get even better as the rollout of the Chevrolet Silverado and GMC Sierra trucks continues, including the introduction of diesel-powered and heavy-duty pickups this year and large SUVs early in 2020.

“We delivered a solid quarter as we begin to demonstrate the earnings power of our full-size truck business,” Chief Executive Mary Barra said on a call with analysts.

GM is open to working with other automakers on the development of electric vehicles, Barra also said.

GM’s strong showing came despite slumping industry demand in China, the world’s largest auto market.

Other automakers, including U.S. rival Ford Motor Co F.N and Germany's Daimler AG DAIGn.DE, offered disappointing forecasts last week.

GM also faces an escalating price war in the lucrative U.S. pickup truck segment for its newly-revamped Chevrolet Silverado. Nevertheless, GM was able to add $1 billion in profits in the quarter in North America thanks to stronger pricing and higher sales of more lucrative vehicles.

Fiat Chrysler Automobiles NV (FCA) FCHA.MIFCAU.N has been battling for market share with its all-new Ram pickup and outsold the Silverado in the second quarter.

FCA took the market by surprise on Wednesday by sticking to its full-year profit guidance after a strong performance from its Ram pickup truck in North America helped it defy the industry slowdown.

FILE PHOTO: General Motors Co. displays the new Chevrolet 2020 Silverado HD pickup truck at the GM Flint Assembly Plant in Flint, Michigan, U.S. February 5, 2019. REUTERS/Rebecca Cook/File Photo

GM’s overall U.S. sales fell 1.5% in the second quarter.

In the second quarter, GM’s China sales slid 12%, a slight improvement over the 17.5% decline in the first quarter.

GM said industry-wide sales in China should remain weak for the rest of the year, but added that its vehicle lineup in that market will be boosted by the addition of new SUVs.

GM’s equity income from its Chinese operations fell to $235 million from $592 million a year earlier. The automaker said Chinese equity income in the second half of the year should roughly match the $611 million it posted for the first half.

The company said it still expects full-year 2019 earnings per share in a range from $6.50 to $7. Analysts are expecting $6.62 a share.

The automaker also said it still expects full-year adjusted automotive free cash flow in a range of $4.5 billion to $6 billion, meaning it would need to generate between $5.9 billion and $7.4 billion in the second half of the year. Jefferies analyst Philippe Houchois said in a research note that hitting the cash flow target “still looks challenging.”

GM’s capital spending in the second quarter fell $700 million from last year to $1.4 billion.

GM Chief Financial Officer Dhivya Suryadevara said the carmaker still expects capital spending for the year of $8 billion to $9 billion. She added that the impact of tariffs and commodity costs this year will be half the $1 billion the company forecast in January.

GM has achieved $1.1 billion in savings so far this year related to the restructuring that included plans to cut 15,000 jobs and end production at five North American plants, Suryadevara said. GM previously forecast savings in 2019 in the range of $2 billion to $2.5 billion.

The plan came under withering criticism from U.S. President Donald Trump and members of Congress.

GM reported second-quarter net income of $2.41 billion or $1.66 per share, compared with $2.39 billion or $1.66 per share a year earlier. Excluding one-time items, GM reported earnings of $1.64 per share.

Analysts had on average expected earnings per share of $1.44, according to IBES data from Refinitiv.

GM reported second-quarter revenue of $36.1 billion, above analysts’ estimates of $35.98 billion.