An activist investor’s successful campaign to win seats on the board of Exxon Mobil Corp. XOM 1.17% represents a historic defeat for the oil giant, one that will likely force it to more directly confront growing shareholder concerns about climate change. Exxon said Wednesday a preliminary vote count showed shareholders backed two nominees of Engine No. 1, an upstart hedge fund owning a tiny fraction of the oil giant’s stock. The final vote wasn’t tallied as of late Wednesday afternoon, and the final composition of the board was unclear.

Exxon Chief Executive Darren Woods was also re-elected to the board along with seven of Exxon’s candidates, while the vote was too close to call for five nominees, the company said.

The vote culminated one of the most expensive proxy fights ever. It was an enormous blow to Mr. Woods, who personally campaigned against Engine No. 1.

“We welcome all of our new directors and look forward to working with them constructively,” Mr. Woods said in a statement. Engine No. 1 sought four seats on Exxon’s board and argued the Texas oil giant should commit to carbon neutrality, effectively bringing its emissions to zero—both from the company and its products—by 2050, as some peers have.

It nominated four directors— Gregory Goff, Kaisa Hietala, Alexander Karsner and Anders Runevad —and Mr. Goff and Ms. Hietala were elected Wednesday, according to the preliminary tally. Mr. Goff is the former chief executive of Andeavor, which was one the largest U.S. refiners before being purchased for more than $20 billion by Marathon Petroleum Corp. MPC 1.32% in 2018, while Ms. Hietala is a former executive vice president of renewable products at Finnish refiner Neste Oyj.

Engine No. 1 accused Exxon’s board of presiding over the company’s demise and argued its own candidates had the qualifications to help Exxon better navigate the energy transition.

The hedge fund called for Exxon to gradually diversify its investments to be ready for a world that will need fewer fossil fuels in coming decades. Exxon defended its strategy to expand drilling, saying demand for fuels and plastics will remain strong for years to come, and pointed to a new carbon capture and storage business unit as evidence it is taking climate change seriously.

Peter Bryant, a managing partner at business consultant Clareo, said Exxon was vulnerable because it hasn’t provided a good return from fossil fuels for years and doesn’t get credit from sustainability-focused investors because it hasn’t invested in renewable energy.

“It’s the worst of both worlds,” Mr. Bryant said.