Sales of electric vehicles (EVs) are booming, and governments worldwide are investing heavily in technology to keep it going. According to BloombergNEF, EVs could go from 10% of global vehicle sales in 2021 to over 40% by 2030. Transitioning from gas-powered vehicles to EVs won't be an easy feat. The energy grid must be ready for a world where EVs are commonplace. 

NextEra Energy (NEE 0.51%) and TotalEnergies (TTE 1.39%) are two energy stocks in an excellent position to benefit from the EV boom. These companies are investing in renewable energy sources while also increasing the availability of charging stations globally to help facilitate more EV sales. If you're looking to take advantage of the EV boom, these two stocks can be a solid addition to your portfolio -- here's why.

1. NextEra Energy will support the EV boom with clean energy

NextEra Energy is one of the largest power and energy companies in the U.S. and will help the transition to EVs by investing in clean energy to power its grid. It operates two segments: Florida Power & Light (FPL) and NextEra Energy Resources (NEER).

The company provides millions of Floridians with power from natural gas, nuclear, solar, and wind power. Its FPL segment produces strong cash flows that it reinvests in renewable energy investments. The company is already North America's largest producer of wind and solar energy and aggressively invested in renewables through NEER.

NextEra has barely scratched the surface of what's possible. According to CEO John Ketchum, "We intend to build more wind, more solar, and more battery storage than anybody else in this country year in and year out regardless of the headwinds or tailwinds in any given year. We believe that we have the competitive advantages to win under any market conditions." 

With so many EVs hitting the road in the next decade, it wants to ensure the energy people use to charge their cars is as clean as possible. The company sees renewables as a massive market opportunity. It believes the total addressable market for renewables, storage, and transmission will be about $8 trillion by 2050.

Since 2009, it has constructed 50 solar energy centers and invested in pilot projects to advance microgrid technology and EV charging while eliminating coal in its fleet in Florida. One of its newer projects is the Cavendish NextGen Hydrogen Hub. This project could be a huge step forward to see if it can replace natural gas with green hydrogen, which could unlock 100% carbon-free electricity.

NextEra's investment in renewable energy to power the grid that will charge those EVs makes this an excellent energy stock for the long haul.

2. TotalEnergies looks to accelerate EV adoption in Europe

TotalEnergies is an energy and gas company headquartered in France helping to accelerate EV adoption in Europe. The company tries to strike a balance between supporting old gas-powered technology and investing in new technologies to support EVs.

It benefited from higher oil and gas prices this year and is putting this cash to work. It continues to invest in oil but only seeks the best, low-cost opportunities it can find. As a result, its breakeven price of oil is $25 per barrel, meaning it has a lot of room for profit given the current price of oil. At that price, TotalEnergies should continue to rake in cash, which it will then put to work in renewables and EV infrastructure.

TotalEnergies plans to spend between $14 billion and $18 billion on capital investments, a third of which will go toward non-carbon projects. It is investing in two specific aspects to help facilitate the EV transition. One is building charging infrastructure. It plans to build 150,000 charging ports across Europe by 2025. It's also working on 900 service stations across highways and cities across Europe to support EV travel across the continent. 

The second part of its investments focuses on developing high-performance batteries to help get more EVs on the road. The company is in a joint venture with Stellantis and Mercedes-Benz called the Automotive Cells Company. It plans to manufacture automotive batteries in 2023 to produce enough batteries to power one million EVs annually across Europe. 

TotalEnergies is a solid business that benefits from higher oil and gas prices today while positioning itself for an EV boom in the coming decades -- making it another solid energy stock you can add to your portfolio today.