Renewables accounted for 51% of the total a year earlier.
Wind farms generated 24.4% of the total, up from 24.1% a year earlier, Redeia said in a statement.
Solar plants generated 16.3% of the total, up from 13.8%, while hydropower dams accounted for 15.9%, up from 9.8%.
Spain aims to generate four-fifths of its electricity from renewables by 2030 under a government plan published last year.
Its main non-renewable source of electricity is nuclear, which produced 18.6% of its electricity in the first half, meaning close to 80% of Spain's power was carbon-free.