GM CEO and chairman Mary Barra speaks during an "EV Day" on March 4, 2020 at the company's tech and design campus in Warren, Mich., a suburb of Detroit

DETROIT – General Motors will spend more than $20 billion through 2025 on its next generation of all-electric and autonomous vehicles as it aims to gain a foothold in the fast-growing market for new auto technologies.

The investment is GM's hardest push yet to convince skeptics, particularly on Wall Street, that the more than 110-year-old automaker can compete against Tesla as the auto industry pivots to all-electric vehicles. GM showed and discussed 11 new all-electric vehicles Wednesday as part of its plans through 2025, which includes at least 20 new models by 2023. CNBC first reported GM would unveil the products at its "EV Day."

The company declined to break down how much of the $20 billion would go specifically to all-electric vehicles but said that the amount includes capital and engineering resources.

"This is a huge opportunity for us. The biggest opportunity any of us has ever seen for this company, certainly," GM President Mark Reuss said. "And we are all-in. It represents a chance to reinvent the company and reset our brands. It will change this company and people's perception of it forever."

Shares of GM were up nearly 2% to $31.03 per share after the announcement. GM stock is down 21.5% in the past year, including a roughly 16% decline this year.