The project, which will benefit from a 15-million-euro ($16.5 million) EU subsidy, is designed to help BP reduce the carbon footprint of its oil refinery located in Castellon, the two companies said in a joint statement.
BP and Iberdrola will each finance half of the project, but they did not disclose the cost of building the plant.
Green hydrogen production uses electricity from renewable power plants, such as wind and solar, to separate hydrogen from water through electrolysis and is part of Europe's strategy to tackle carbon emissions and improve energy security.